This repository has been archived by the owner on Feb 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
OnPlayerClick
GtakillerIV edited this page Nov 14, 2014
·
2 revisions
Gets called when a player clicks any of the 3 mouse buttons
playerid
The player's id.
type
Which mouse button was pressed.
X
The X-coordinate of the cursor at the time of the click
Y
The Y-coordinate of the cursor at the time of the click
public OnPlayerClick(playerid, type, X, Y)
{
new vehId = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
switch(type)
{
//If the player clicked the left mouse button
case MOUSE_LEFT_CLICK:
{
//Add nitrous
AddVehicleComponent(vehId, 1010);
SendClientMessage(playerid, -1, "NOS Added!");
}
//if the player clicked the right mouse button
case MOUSE_RIGHT_CLICK:
{
//Fix the vehicle
RepairVehicle(vehId);
SendClientMessage(playerid, -1, "Vehicle Repaired!");
}
//if the player clicked the middle mouse button
case MOUSE_MIDDLE_CLICK:
{
//Flip the vehicle
new Float:angle;
GetVehicleZAngle(vehId, angle);
SetVehicleZAngle(vehId, angle);
SendClientMessage(playerid, -1, "Vehicle flipped!");
}
}
}
}