06.04.2017, 19:50
Ahoy friends.
Thats the command i have
Is it possible to use sscanf instead of strcmp to check if the entered string matches?
Like
Thats the command i have
Код:
if(strcmp(cmd, "/checkmoney", true) == 0) { if(IsPlayerAdmin(playerid)) { new targetplayer; new tname[144]; if(sscanf(cmdtext[strlen("/checkmoney")+1], "u", targetplayer)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /checkmoney [playerid]"); if(!IsPlayerConnected(targetplayer)) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected"); if(gPlayerHasTeamSelected[targetplayer] == -1) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player is still in team selection!"); GetPlayerName(targetplayer,tname,sizeof(tname)); SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Player %s(%d) is in posession of $%d at this moment",tname,targetplayer,GetPlayerMoney(targetplayer)); } }
Like
Код:
new targetplayer; if(sscanf(cmdtext[strlen("/checkmoney")+1], "u", targetplayer)) { if(IsPlayerAdmin(playerid)) { new targetplayer; new tname[144]; if(!IsPlayerConnected(targetplayer)) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player not connected"); if(gPlayerHasTeamSelected[targetplayer] == -1) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Player is still in team selection!"); GetPlayerName(targetplayer,tname,sizeof(tname)); SendClientMessageEx(playerid,COLOR_WHITE,"SERVER: Player %s(%d) is in posession of $%d at this moment",tname,targetplayer,GetPlayerMoney(targetplayer)); } } else { return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /checkmoney [playerid]"); }