Skip to content

Instantly share code, notes, and snippets.

@dennorske
Created January 16, 2013 19:36
Show Gist options
  • Save dennorske/4550092 to your computer and use it in GitHub Desktop.
Save dennorske/4550092 to your computer and use it in GitHub Desktop.
CMD:passenger (playerid,params[])
{
new driver;
new string123[165];
new veh = GetPlayerVehicleID(driver);
if (PlayerInfo[playerid][aLevel] < 1)
return SendClientMessage(playerid, RED, "Only Administrators level 1+ can use this command");
if(sscanf(params, "i",driver))
return SendClientMessage(playerid, RED, "Hello Admin! Usage: "corange"/PASSENGER [Playerid]");
//Is he connected?
if(!IsPlayerConnected(driver))
return SendClientMessage(playerid, RED, "Player is not found.");
//Check if it is yourself
if(driver == playerid)
return SendClientMessage(playerid, RED, "You cant do this command on yourself!");
//Check if he is in vehicle
if(!IsPlayerInAnyVehicle(driver))
return SendClientMessage(playerid, RED, "Selected player is not in any vehicle.");
if((GetPlayerState(driver) == PLAYER_STATE_DRIVER) == false)
return SendClientMessage(playerid, RED, "Selected player is not the Vehicle driver.");
if(GetTeam{playerid} == CLASS_COPS ||GetTeam{playerid} == CLASS_CIA || GetTeam{playerid} == CLASS_FBI
&& GetTeam{driver} == CLASS_CIV && GetPlayerWantedLevel(driver) >=1)
return SendClientMessage(playerid, RED, "Selected Player is currently wanted, and you are a Cop. Function is Disabled, try again later (prevent abusing)");//Check if you are a cop AND that the entered player is wanted.
//If nothing of above stopped the admin from doing the command, below is the continuos script for the command. Spunky.
// put him in seat 1, passenger, in the drivers vehicle id
PutPlayerInVehicle(playerid, veh, 1);
//If it didnt work correctly, this message will appear:
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
return SendClientMessage(playerid, RED, "An error occured. Please contact the Scripter");
else if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
format(string123, sizeof(string123), "You have now successfully entered the car as a passenger with player id %s", driver);
SendClientMessage(playerid, GREEN, string123);//message
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment