Help remove player driving license
#1

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
Reply
#2

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.
Reply
#3

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 !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)