dcmd_wank(playerid,params[])
{
new string[128],ID,aName[MAX_PLAYER_NAME],Name[MAX_PLAYER_NAME],Float:x,Float:y,Float:z;
GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerName(ID,aName,sizeof(aName));
GetPlayerPos(playerid,x,y,z);
if(sscanf(params,"u",ID))
{
format(string,sizeof(string),"%s (%d) wanks on himself.",Name,playerid);
SendClientMessageToAll(white,string);
ApplyAnimation(playerid,"PAULNMAC","wank_out",4.1,1,1,1,1,1,1);
}
else if(IsPlayerInRangeOfPoint(ID,5,x,y,z))
{
format(string,sizeof(string),"%s (%d) wanks on %s (%d).",Name,playerid,aName,ID);
SendClientMessageToAll(white,string);
ApplyAnimation(playerid,"PAULNMAC","wank_out",4.1,1,1,1,1,1,1);
} else return SendClientMessage(playerid,red,"Player is not close enough");
return 1;
}
dcmd_wank(playerid,params[])
{
if(!IsPlayerConnected(playerid)) return 1;
new string[128],ID,aName[MAX_PLAYER_NAME],Name[MAX_PLAYER_NAME],Float:x,Float:y,Float:z;
GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerName(ID,aName,sizeof(aName));
GetPlayerPos(playerid,x,y,z);
if(sscanf(params,"u",ID))
{
format(string,sizeof(string),"%s (%d) wanks on himself.",Name,playerid);
SendClientMessageToAll(white,string);
ApplyAnimation(playerid,"PAULNMAC","wank_out",4.1,1,1,1,1,1,1);
}
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,red,"Invalid ID");
if(IsPlayerInRangeOfPoint(ID,5,x,y,z))
{
format(string,sizeof(string),"%s (%d) wanks on %s (%d).",Name,playerid,aName,ID);
SendClientMessageToAll(white,string);
ApplyAnimation(playerid,"PAULNMAC","wank_out",4.1,1,1,1,1,1,1);
// thoug there is needed animation for player `ID`
} else return SendClientMessage(playerid,red,"Player is not close enough");
return 1;
}
if(!IsPlayerConnected(playerid)) return 1;
 
 if(!IsplayerConnected(playerid)) return 1;
// that would check if typer is connected or check if it is not a bot. or something like that.
dcmd_wank(playerid,params[])
{
new ID; <-- ID is empty which means 0
...
GetPlayerName(ID,aName,sizeof(aName)); <-- ID is still 0
...
if(sscanf(params,"u",ID)) <-- This is where you find out what ID is
{
...
}
...
return 1;
}
| Your problem is that you use GetPlayerName on ID before you find out what ID is. That means when you use "GetPlayerName(ID,aName,sizeof(aName));" ID is still new, uninitialised, aka 0. So the name will always be the name of player 0. pawn Код: 
 | 
dcmd_wank(playerid,params[])
{
new string[128],ID,aName[MAX_PLAYER_NAME],Name[MAX_PLAYER_NAME],Float:x,Float:y,Float:z;
GetPlayerName(playerid,Name,sizeof(Name));
GetPlayerPos(playerid,x,y,z);
if(sscanf(params,"u",ID))
GetPlayerName(ID,aName,sizeof(aName));
 
 
 dcmd_wank(playerid,params[])
{
if(!IsPlayerConnected(playerid)) return 1;
new string[90],ID,aName[MAX_PLAYER_NAME],Name[MAX_PLAYER_NAME],Float:x,Float:y,Float:z;
GetPlayerName(playerid,Name,sizeof(Name));
GetPlayerPos(playerid,x,y,z);
if(sscanf(params,"u",ID))
{
format(string,sizeof(string),"%s (%d) wanks on himself.",Name,playerid);
SendClientMessageToAll(white,string);
ApplyAnimation(playerid,"PAULNMAC","wank_out",4.1,1,1,1,1,1,1);
}
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,red,"Invalid ID");
if(IsPlayerInRangeOfPoint(ID,5,x,y,z))
{
GetPlayerName(ID,aName,sizeof(aName));
format(string,sizeof(string),"%s (%d) wanks on %s (%d).",Name,playerid,aName,ID);
SendClientMessageToAll(white,string);
ApplyAnimation(playerid,"PAULNMAC","wank_out",4.1,1,1,1,1,1,1);
// thoug there is needed animation for player `ID`
} else return SendClientMessage(playerid,red,"Player is not close enough");
return 1;
}