[EJECT PASSANGER ] [+REP]
#5

Quote:
Originally Posted by Abagail
Посмотреть сообщение
pawn Код:
CMD:eject(playerid, params[])
{
if(!GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "You aren't the driver of a vehicle.");
new giveplayerid;
if (sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, -1, "USAGE: /eject [playerid]");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, -1, "Invalid Player ID/Name Specified.");
new vehicleid = GetPlayerVehicleID(playerid));
new vehicleid2 = GetPlayerVehicleID(giveplayerid));
if(vehicleid != vehicleid2) return SendClientMessage(playerid, -1, "They aren't in your vehicle.");
new string[128];
format(string, sizeof(string), "You have been ejected by Driver %s.", GetName(playerid));
SendClientMessage(giveplayerid, -1, string);
format(string, sizeof(string), "You have ejected passenger %s.", GetName(giveplayerid));
SendClientMessage(playerid, -1, string);
return 1;
}
Untested.
dude ^^
this code will fail hard, it'll be as if that if(!GetPlayerState...... line never existed :P

cuz of this line
Код:
if(!GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "You aren't the driver of a vehicle.");
you can't just use the negation operator like this.
you have to use braces
Код:
if(!(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)) return SendClientMessage(playerid, -1, "You aren't the driver of a vehicle.");
or do it like this
Код:
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "You aren't the driver of a vehicle.");
"untested" ?
quoting the rules:
Quote:
Do Not Post Untested Code - If you are replying to a problem and you haven't confirmed that your code will work, you are likely to make the problem worse, not better.
- no offense
Reply


Messages In This Thread
[EJECT PASSANGER ] [+REP] - by SPA - 08.04.2014, 11:38
Re: [EJECT PASSANGER ] [+REP] - by xVIP3Rx - 08.04.2014, 11:41
Re: [EJECT PASSANGER ] [+REP] - by CutX - 08.04.2014, 11:47
Re: [EJECT PASSANGER ] [+REP] - by Abagail - 08.04.2014, 11:53
Re: [EJECT PASSANGER ] [+REP] - by CutX - 08.04.2014, 12:09
Re: [EJECT PASSANGER ] [+REP] - by SPA - 08.04.2014, 12:34
Re: [EJECT PASSANGER ] [+REP] - by SPA - 08.04.2014, 12:40
Re: [EJECT PASSANGER ] [+REP] - by CutX - 08.04.2014, 12:43
Re: [EJECT PASSANGER ] [+REP] - by ChandraLouis - 08.04.2014, 12:45
Re: [EJECT PASSANGER ] [+REP] - by xVIP3Rx - 08.04.2014, 12:45

Forum Jump:


Users browsing this thread: 2 Guest(s)