09.07.2015, 18:48
Alright. The issue is either in if(!IsPlayerConnected(targetid)) or in if(playerid == targetid). The reason I believe it to be one of these 2, is showed in the video below.
VIDEO:Forcecmds command bug.
The command:
It compiles just fine. No issues there, but it doesn't appear to be checking if(!IsPlayerConnected(targetid)) and if(playerid == targetid) appears to be bugged, because no matter what ID you put. It will always return as your ID.
VIDEO:Forcecmds command bug.
The command:
Код:
CMD:forcecmds(playerid, params[])
{
new targetid, string[200];
if(!IsPlayerAdmin(playerid)) return 0;
if(IsPlayerAdmin(playerid))
{
if(sscanf(params, "u", targetid)) return SendMessage(playerid, COLOR_RED, "USAGE: /forcecmds <playerid>");
if(!IsPlayerConnected(targetid)) return SendMessage(playerid, COLOR_RED, "ERROR: No one with that ID is connected to the server.");
if(playerid == targetid) return SendMessage(playerid, COLOR_RED, "You can't use this command on yourself.");
ShowPlayerCmds(targetid);
}
format(string, sizeof(string), "Admin %s(%d) Has shown you all available commands.", PlayerName(playerid), playerid);
SendMessage(targetid, COLOR_LIME, string);
return 1;
}

