/eject works only with id 0 -
Face9000 - 01.06.2012
Ok so,i coded this little /eject command,but it works only if i want eject id 0.
pawn Код:
CMD:ej(playerid,params[])
{
if(!strlen(params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /ej [Player/ID]");
new string[128];
new string2[128];
new DestName[24];
new Destinationid;
new name[24];
GetPlayerName(playerid, name, 24);
GetPlayerName(Destinationid, DestName, 24);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && IsPlayerInVehicle(Destinationid, GetPlayerVehicleID(playerid)))
{
if(IsPlayerConnected(Destinationid) && playerid != Destinationid)
{
format(string2, 128, "You have ejected %s (%i) from your vehicle.", DestName, Destinationid);
SendClientMessage(playerid, orange, string2);
GameTextForPlayer(playerid,"~r~Player ejected from vehicle!",3000,5);
format(string, 128, "You got ejected from %s's (%d) vehicle.", name, playerid);
SendClientMessage(playerid, orange, string);
RemovePlayerFromVehicle(Destinationid);
GameTextForPlayer(Destinationid,"~r~You have been ejected!",3000,5);
}
}
return true;
}
What's wrong?
Re: /eject works only with id 0 -
ReneG - 01.06.2012
Hahahahah I ******d "sscanf 0 ID bug"
https://sampforum.blast.hk/showthread.php?tid=339361
Re: /eject works only with id 0 -
Face9000 - 01.06.2012
Quote:
Originally Posted by VincentDunn
|
Lol my sscanf is updated,all other commands works good.
Re: /eject works only with id 0 -
MadeMan - 01.06.2012
You should use sscanf in this command.
Re: /eject works only with id 0 -
Face9000 - 01.06.2012
Fixed,thanks.
Re: /eject works only with id 0 -
JaKe Elite - 01.06.2012
Quote:
Originally Posted by VincentDunn
|
lol?
Re: /eject works only with id 0 -
Sandiel - 01.06.2012
Try this, you'll need ZCMD, and sscanf
Код:
COMMAND:eject(playerid, params[])
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
{
new targetid;
if(!sscanf(params, "u", targetid))
{
if(GetPlayerState(targetid) == PLAYER_STATE_PASSENGER))
{
new vehID;
vehID = GetPlayerVehicleID(playerid);
new Float:vehX, Float:vehY, Float:vehZ;
GetVehiclePos(vehID, vehX, vehY, vehZ);
SetPlayerPos(targetid, vehX, vehY+2, vehZ);
SendClientMessage(targetid, COLOR_WHITE, "You have been ejected from the vehicle!");
}
}
}
return 1;
}
Re: /eject works only with id 0 -
Adrian9696 - 01.06.2012
Place this command to public OnPlayerCommandText in your game mode
Код:
if(strcmp(cmd, "/eject", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new State;
if(IsPlayerInAnyVehicle(playerid))
{
State=GetPlayerState(playerid);
if(State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,COLOR_GREY," You can only eject people as the driver !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /eject [playerid/PartOfName]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
new test;
test = GetPlayerVehicleID(playerid);
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Eject yourself!"); return 1; }
if(IsPlayerInVehicle(playa,test))
{
new PName[MAX_PLAYER_NAME];
GetPlayerName(playerid,PName,sizeof(PName));
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You have thrown %s out of the car!", giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* You have been thrown out the car by %s !", PName);
SendClientMessage(playa, COLOR_WHITE, string);
RemovePlayerFromVehicle(playa);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not in your Car !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Invalid ID/Name!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You need to be in a Vehicle to use this !");
}
}
return 1;
}
Re: /eject works only with id 0 -
JaKe Elite - 01.06.2012
Its fixed. No need helping.
Need quote? here you go
Quote:
Originally Posted by Logitech90
Fixed,thanks.
|