PDA

View Full Version : Help remove player driving license


Guss
13/03/2015, 08:50 PM
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

Misiur
13/03/2015, 10:29 PM
Do this:
//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.

Guss
13/03/2015, 11:08 PM
Do this:
//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 !!