/eject - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /eject (
/showthread.php?tid=449854)
/eject -
Pilip93 - 10.07.2013
Код:
CMD:eject(playerid, params[])
{
if(GetPlayerVehicleID(playerid))
if(IsPlayerAdmin(playerid))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, -1, "Player got Ejected!");
}
else SendClientMessage(playerid,RED,"[AG] You do not have enough Admin Permissions to execute this Command!");
return 1;
}
How to make this command to a specifc player? By ID.
Re: /eject -
Champ - 10.07.2013
makng a variable target to work on target. The code below is an example on how to make a command effect on a player.
pawn Код:
CMD:eject(playerid, params[])
{
new target
if(sscanf(params, "ui", target, level)) return SendClientMessage(playerid, COLOR_ORANGE, "[*] Usage: /makeadmin [playerid/name] [level]");
else if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ORANGE, "[*] Enter a valid player ID/name!");
if(GetPlayerVehicleID(playerid))
if(IsPlayerAdmin(playerid))
{
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(target, pName, MAX_PLAYER_NAME);
RemovePlayerFromVehicle(playerid);
format(string, sizeof string, "%s has been ejected", pName);
SendClientMessage(playerid,string);
}
else SendClientMessage(playerid,RED,"[AG] You do not have enough Admin Permissions to execute this Command!");
return 1;
}
but it requires sscanf.
Re: /eject -
Pilip93 - 11.07.2013
That didnt work. Is it for a admin system or rcon admin? As Iam using rcon.
I got sscanf2
Re: /eject -
JJB562 - 11.07.2013
Change
pawn Код:
RemovePlayerFromVehicle(playerid);
To
pawn Код:
RemovePlayerFromVehicle(target);
Re: /eject -
Jefff - 11.07.2013
pawn Код:
CMD:eject(playerid, params[])
{
new ID;
if(!IsPlayerAdmin(playerid)) SendClientMessage(playerid,RED,"[AG] You do not have enough Admin Permissions to execute this Command!");
else if(isnull(params)) SendClientMessage(playerid,-1,"Usage: /eject [playerid]");
else if(!IsPlayerConnected((ID = strval(params)))) SendClientMessage(playerid,RED,"Player is not online");
else{
new veh = GetPlayerVehicleID(ID);
if(veh == 0 || veh == INVALID_VEHICLE_ID) SendClientMessage(playerid,RED,"Player is not in vehicle");
else{
RemovePlayerFromVehicle(ID);
SendClientMessage(playerid, -1, "Player got Ejected!");
}
}
return 1;
}
Re: /eject -
ThePhenix - 11.07.2013
You need sscanf2 include/plugin and zcmd include.
Code:
PHP код:
CMD:eject(playerid, params[])
{
new targetid, string[128], N[MAX_PLAYER_NAME];
new name = GetPlayerName(targetid, N, sizeof(N));
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "USAGE: /eject [playerid]");
if(!IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid, -1, "ERROR: Player is not in a vehicle");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "ERROR: You must be an Administrator to use this command");
RemovePlayerFromVehicle(targetid);
format(string, sizeof(string), "Player %s has been ejected of his vehicle", name);
SendClientMessageToAll(-1, string);
return 1;
}
Re: /eject -
Pilip93 - 11.07.2013
THank you!