18.12.2012, 19:24
Hmm, I actually hoped you didnt have sscanf and zcmd, i specially wroted and tested it for you, since you share my name (my name isnt Mike but Martin)
copy paste it right into onplayercommandtext and no errors will show up, if the 'cmd' and 'tmp' variables arent defined yet.
edit: EDITED and works now if done correctly.
pawn Код:
new cmd[128], tmp[128];
tmp = strtok(cmdtext, idx);
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/fp", true) == 0)
{
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /fp [id]");
if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFFFFFFFF, "Player not connected.");
new str[128],fpname[MAX_PLAYER_NAME],myname[MAX_PLAYER_NAME];
GetPlayerName(strval(tmp),fpname,sizeof(fpname));
GetPlayerName(playerid,myname,sizeof(myname));
format(str,128,"%s facepalms on %s's comment.",myname,fpname);
SendClientMessageToAll(0xFF66FFAA,str);
return 1;
}
edit: EDITED and works now if done correctly.