SA-MP Forums Archive
Help remove player driving license - 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: Help remove player driving license (/showthread.php?tid=567422)



Help remove player driving license - Guss - 13.03.2015

Hi there, I want to remove the players driving license and I made a command..

Код:
dcmd_nodriving( playerid, params[])
{
    {
    new pid;
    new str[68], pName[MAX_PLAYER_NAME],Float:x, Float:y, Float:z;
    GetPlayerName(pid, playername, sizeof(playername));
    if(sscanf(params, "u", pid)) return SendClientMessage(playerid, -1, "Usage: /nodriving (player id)");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, Color_Red, "Player must be connected.");
    RemovePlayerFromVehicle(pid);
    format(str, sizeof(str), "%s loses her driving license", playername);
    SendClientMessageToAll(Color_Red, str);
    GetPlayerPos(pid, x, y, z);
    SetPlayerPos(pid, x, y, z);
    nocar[pid] = true;
    }
    return true;
}
The problem is that remove the license of "PlayerB" (being I Admin) placed in chat "Admin loses her driving license"

The effect of the command is true, but the name of who loses his driver's license is always wrong. What is the error?

I need help please, regards


Re: Help remove player driving license - Misiur - 13.03.2015

Do this:
pawn Код:
//Reorder this:

GetPlayerName(pid, playername, sizeof(playername));
if(sscanf(params, "u", pid)) return SendClientMessage(playerid, -1, "Usage: /nodriving (player id)");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, Color_Red, "Player must be connected.");

//into this

if(sscanf(params, "u", pid)) return SendClientMessage(playerid, -1, "Usage: /nodriving (player id)");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, Color_Red, "Player must be connected.");
GetPlayerName(pid, playername, sizeof(playername));
PID is not yet present, and it's value by default is 0.


Respuesta: Re: Help remove player driving license - Guss - 13.03.2015

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Do this:
pawn Код:
//Reorder this:

GetPlayerName(pid, playername, sizeof(playername));
if(sscanf(params, "u", pid)) return SendClientMessage(playerid, -1, "Usage: /nodriving (player id)");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, Color_Red, "Player must be connected.");

//into this

if(sscanf(params, "u", pid)) return SendClientMessage(playerid, -1, "Usage: /nodriving (player id)");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, Color_Red, "Player must be connected.");
GetPlayerName(pid, playername, sizeof(playername));
PID is not yet present, and it's value by default is 0.
is working. thank you very much !!