There is something wrong with these commands.
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;
}
Код:
#define MAX_SLOTS 10
new Stunned[MAX_SLOTS];
new PlayerSuspect[MAX_SLOTS];
if(strcmp(cmd, "/jail", true) == 0)
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
new giveplayerid;
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 could not jail an officer that follows the law to.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "That playerid is not close (enough) to you!");
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not a cop.");
}
return 1;
}
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(64) : error 017: undefined symbol "cmd"
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(67) : warning 217: loose indentation
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(67) : error 017: undefined symbol "strtok"
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(67) : error 033: array must be indexed (variable "cmd")
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(71) : warning 217: loose indentation
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(71) : error 017: undefined symbol "tmp"
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(73) : error 017: undefined symbol "COLOR_GREY"
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(76) : error 017: undefined symbol "tmp"
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(77) : error 017: undefined symbol "tmp"
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(77) : error 017: undefined symbol "strtok"
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(78) : error 017: undefined symbol "giveplayer"
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(78) : error 017: undefined symbol "giveplayer"
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(78) : error 029: invalid expression, assumed zero
C:\Users\Robin\Desktop\SA-MP 0.3C\filterscripts\copcmds.pwn(78) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
12 Errors.