CMD:passenger (playerid,params[])
{
new driver;
new string123[165];
new veh = GetPlayerVehicleID(driver); // ------- Thats the Variable i used in PutPlayerInVehicle, to get vehicle ID...
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); // Here it is
//DEBUGGING;
new string11[128];
new string111[128];
format(string11, sizeof(string11), "Variable veh = %d", veh);
SendClientMessageToAll(RED, string11);
format(string111, sizeof(string111), "Variable driver id = %d", driver);
SendClientMessageToAll(RED, string111);
//____________________________________________________________________
//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");
//successful:
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;
}
new driver = params[0];
airplanesimen: That's not how variables work - just because two have the same name doesn't make them the same! It's like two people called "Mark" are not the same person, and if you make a new person and call it Mark, it doesn't instantly become the other two.
park4bmx: That's not how "params" works! |
new veh;
if(sscanf(params,"u",driver) return ...................
veh = GetPlayerVehicleID(driver);
Why don't you just try it and see for yourself? Also: Unless you intend to use this with bots, you may use 'r' instead of 'u'.
|