15.12.2010, 15:45
There is something wrong with these commands.
They give error's. Can someone help me?
They give error's. Can someone help me?
Код:
if(strcmp(cmd, "/stun", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /stun [playerid]"); return 1; } giveplayerid = strval(tmp); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(gTeam[playerid] == TEAM_COP) { if(PlayerToPoint(8, giveplayerid, x , y, z)) { if(gTeam[giveplayerid] != TEAM_COP) { Stunned[giveplayerid] = 1; KillTimer(StunTimer[giveplayerid]); StunTimer[giveplayerid] = SetTimerEx("SetPlayerUnstun", 10000, false, "d", giveplayerid); format(string, sizeof(string), "Officer %s has stunned (suspect) %s", sendername, giveplayer); SendClientMessageToAll(COLOR_BLUE, string); ApplyAnimation(giveplayerid,"PED","KO_shot_stom",4.1,0,1,1,1,1); TogglePlayerControllable(giveplayerid, false); KillTimer(StunTimer2[playerid]); StunTimer2[playerid] = SetTimerEx("ClearPlayerAnimations", 5000, false, "d", playerid); return 1; } else { SendClientMessage(playerid, COLOR_RED, "You cannot stun an officer."); } } else { SendClientMessage(playerid, COLOR_RED, "That playerid is not close (enough) to you!"); } return 1; } else { SendClientMessage(playerid, COLOR_RED,"You are not a part of the cops team."); } return 1; } if(strcmp(cmd, "/jail", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /jail [playerid]"); return 1; } giveplayerid = strval(tmp); tmp = strtok(cmdtext, idx); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(gTeam[playerid] == TEAM_COP) { if(PlayerToPoint(5, giveplayerid, x , y, z)) { if(gTeam[giveplayerid] != TEAM_COP) { if(Stunned[giveplayerid] == 1) { if(PlayerSuspect[giveplayerid] == 1) { PlayerInfo[giveplayerid][pJailedSec] = PLAYER_JAILED_SECONDS; OnPlayerJailed(giveplayerid); format(string, sizeof(string), "Officer %s has jailed (suspect) %s, For %d seconds (reward: $%d,-)", sendername, giveplayer, PLAYER_JAILED_SECONDS, JAIL_MONEY); SendClientMessageToAll(COLOR_BLUE, string); GivePlayerMoney(playerid, JAIL_MONEY); return 1; } else { SendClientMessage(playerid, COLOR_RED, "That player is not a suspect."); } } else { SendClientMessage(playerid, COLOR_RED, "You must first /stun a suspect before you can jail him."); } } else { SendClientMessage(playerid, COLOR_RED, "You cannot jail an officer."); } } else { SendClientMessage(playerid, COLOR_RED, "That playerid is not close (enough) to you!"); } return 1; } else { SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command."); } return 1; }