eject help is player in a player vehicle -
HardBoy - 07.11.2012
hey guys... i'm making eject command but problem i don't have any idea how to make if "ID" is in "Playerid" Vehicle He Can Eject
i just make it like this but unkown lol
i will try to give u idea
for example the ID must be in the playerid vehicle so the playerid can eject him
thats the code
Код:
command(ej, playerid, params[])
{
new ID;
if(sscanf(params,"u",ID)) return SendClientMessage(playerid,AC,"Usage: /ej [playerid]");
else if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,-1,"ERROR:This player isn't connected");
else
{
if(ID == IsPlayerInVehicle(playerid))
{
new Float:xposs, Float:y, Float:z;
RemovePlayerFromVehicle(ID);
GetPlayerPos(ID, xposs, y, z);
SetPlayerPos(ID, xposs, y, z+3);
SendClientMessage(ID, GREY,"You Have Been Ejected From The Vehcile.");
SendClientMessage(playerid, COLOR_RED, "Player Ejected.");
}
else SendClientMessage(playerid, COLOR_RED, "The Player That You Are Trying To Eject Isn't In Your Vehicle.");
}
return 1;
}
lol i tryed to make it like this, but it make no sense
PHP код:
if(ID == IsPlayerInVehicle(playerid))
Re: eject help is player in a player vehicle -
cosbraa - 07.11.2012
pawn Код:
if(IsPlayerInVehicle(ID, GetPlayerVehicleID(playerid) && GetPlayerVehicleSeat(playerid) == 0)
{
//your code
}
Assuming you want it so only the driver can eject the player.
Re: eject help is player in a player vehicle -
doreto - 07.11.2012
if(ID == IsPlayerInVehicle(playerid)) - is wrong becose you check if selected id/target is equally to you(playerid)
pawn Код:
command(ej, playerid, params[])
{
new ID;
if(sscanf(params,"u",ID)) return SendClientMessage(playerid,AC,"Usage: /ej [playerid]");
else if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,-1,"ERROR:This player isn't connected");
else
{
if(IsPlayerInVehicle(ID))
{
new Float:xposs, Float:y, Float:z;
RemovePlayerFromVehicle(ID);
GetPlayerPos(ID, xposs, y, z);
SetPlayerPos(ID, xposs, y, z+3);
SendClientMessage(ID, GREY,"You Have Been Ejected From The Vehcile.");
SendClientMessage(playerid, COLOR_RED, "Player Ejected.");
}
else SendClientMessage(playerid, COLOR_RED, "The Player That You Are Trying To Eject Isn't In Your Vehicle.");
}
return 1;
}
Re: eject help is player in a player vehicle -
HardBoy - 07.11.2012
Quote:
Originally Posted by cosbraa
pawn Код:
if(IsPlayerInVehicle(ID, GetPlayerVehicleID(playerid) && GetPlayerVehicleSeat(playerid) == 0) { //your code }
Assuming you want it so only the driver can eject the player.
|
thanks very much it works
+rep
Re: eject help is player in a player vehicle -
HardBoy - 07.11.2012
Quote:
Originally Posted by doreto
if(ID == IsPlayerInVehicle(playerid)) - is wrong becose you check if selected id/target is equally to you(playerid)
pawn Код:
command(ej, playerid, params[]) { new ID; if(sscanf(params,"u",ID)) return SendClientMessage(playerid,AC,"Usage: /ej [playerid]"); else if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,-1,"ERROR:This player isn't connected"); else { if(IsPlayerInVehicle(ID)) { new Float:xposs, Float:y, Float:z; RemovePlayerFromVehicle(ID); GetPlayerPos(ID, xposs, y, z); SetPlayerPos(ID, xposs, y, z+3); SendClientMessage(ID, GREY,"You Have Been Ejected From The Vehcile."); SendClientMessage(playerid, COLOR_RED, "Player Ejected."); } else SendClientMessage(playerid, COLOR_RED, "The Player That You Are Trying To Eject Isn't In Your Vehicle."); } return 1; }
|
u didn't understand me, i said if the "ID" is in the "playerid" vehicle then the ID will get ejected, if the ID is in another vehicle so the vehicle can't eject, he can only eject people that are in his vehicle
he can't eject people from other vehicles