30.01.2012, 10:24
hi,
first: im using the newest sscanf version
The problem is when i use the "u" specifier in my dcmd commands it sometimes shows "Server: Unknown command".
I have anohter message defined that is shown when there is not the cmd available that u entered.
The problem is the commands using sscanf exists and it also works fine
BUT:
If i enter an ID or a part of a name of a player that is not online on the server it shows this default server error message.
How to prevent that.
How could i do it like there is a message returned saying smth. like: This player has not been found?
Example cmd:
thx
first: im using the newest sscanf version
The problem is when i use the "u" specifier in my dcmd commands it sometimes shows "Server: Unknown command".
I have anohter message defined that is shown when there is not the cmd available that u entered.
The problem is the commands using sscanf exists and it also works fine
BUT:
If i enter an ID or a part of a name of a player that is not online on the server it shows this default server error message.
How to prevent that.
How could i do it like there is a message returned saying smth. like: This player has not been found?
Example cmd:
pawn Код:
dcmd_spectate(playerid,params[])
{
new id;
if(sscanf(params,"u",id))return SendClientMessage(playerid,0xFF0000FF,"Usage: /spec[ID]");
if(Spieler[id][eingeloggt] == 0)return SendClientMessage(playerid,0xFF0000FF,"This Player is not logged in!");
if(id == playerid)return SendClientMessage(playerid,0xFF0000FF,"You can't spectate yourself!");
if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid,0xFF0000FF,"Invalid PlayerID!");
new string[128],name[24]; GetPlayerName(id,name,24);
SetPlayerInterior(playerid,GetPlayerInterior(id));
TogglePlayerSpectating(playerid,true);
PlayerSpectatePlayer(playerid,id);
return 1;
}