ZCMD, 1 error
#1

Please help
Код:
CMD:exitdm(playerid, params[])
{
if(dmid[playerid] == -1) return SendClientMessage(playerid,red, "Error: You are not in a dm zone!");
for(new zone = 0; zone < MAX_ZONES; zone++){
GangZoneHideForPlayer(playerid, zone);}

dmid[playerid] = -1;
if(ingangwar[playerid] >0)
{PlayersOnline--;format(vstring,sizeof(vstring),"~>~ ~r~/gangwar: ~g~%d", PlayersOnline);
TextDrawSetString(Textdraw50,vstring);ingangwar[playerid] = 0;}
SetPlayerColor(playerid,playerColors[playerid]);AutoRepairUsed[playerid] = 0;
AutoRepairTrigger[playerid] = 0;
SpawnPlayer(playerid);
gTeam[playerid] = TEAM_NOTH;
SendClientMessage(playerid,green,"Leave the deathmatch zone");

else if(dmid[playerid] != -1) return SendClientMessage(playerid,red,"ERROR: You cannot use command in dm!");
Reply
#2

Show me what error appear ...
Reply
#3

Error line's:

(16376) error 029: invalid expression, assumed zero
(16376) : error 001: expected token: ";", but found "if"
(16404) : error 030: compound statement not closed at the end of d at line 16362)
Reply
#4

Your code is very messy and difficult to read, also it seems that you're not actually finishing the command with a final bracket. Have a look at this example:

pawn Код:
CMD:exitdm(playerid, params[])
{
    if(dmid[playerid] == -1) return SendClientMessage(playerid,red, "Error: You are not in a dm zone!");
    for(new zone = 0; zone < MAX_ZONES; zone++) GangZoneHideForPlayer(playerid, zone);

    dmid[playerid] = -1;
    if(ingangwar[playerid] >0)
    {
        PlayersOnline--;
        format(vstring,sizeof(vstring),"~>~ ~r~/gangwar: ~g~%d", PlayersOnline);
        TextDrawSetString(Textdraw50,vstring);
        ingangwar[playerid] = 0;
    }
    SetPlayerColor(playerid,playerColors[playerid]);
    AutoRepairUsed[playerid] = 0;
    AutoRepairTrigger[playerid] = 0;
    SpawnPlayer(playerid);
    gTeam[playerid] = TEAM_NOTH;
    SendClientMessage(playerid,green,"Leave the deathmatch zone");

    else if(dmid[playerid] != -1) return SendClientMessage(playerid,red,"ERROR: You cannot use command in dm!");
    return 1;
}
It's a lot easier to read and see where you have gone wrong, in this case it seems the main problem is a missing bracket at the end of the command.

Note: It helps people to help you when you outline which lines they are pointing at, line 16 thousand and something means nothing to us in this context.
Reply
#5

okey
again 2 error:
(16377) : error 029: invalid expression, assumed zero

(16377) error 001: expected token: ";", but found "if"
Reply
#6

Well the else if statement at the end of the code is not part of an if statement! So of course there's going to be an error, you should probably have it at the top of your script, it would make more sense. Then however thinking about it, it doesn't make sense, because then the command could never be used, you seem to require them to be in the dm, then you require them to be out of the DM, make up your mind and use only one of them, for example:

pawn Код:
CMD:exitdm(playerid, params[])
{
    if(dmid[playerid] == -1) return SendClientMessage(playerid,red, "Error: You are not in a dm zone!");
    for(new zone = 0; zone < MAX_ZONES; zone++) GangZoneHideForPlayer(playerid, zone);

    dmid[playerid] = -1;
    if(ingangwar[playerid] >0)
    {
        PlayersOnline--;
        format(vstring,sizeof(vstring),"~>~ ~r~/gangwar: ~g~%d", PlayersOnline);
        TextDrawSetString(Textdraw50,vstring);
        ingangwar[playerid] = 0;
    }
    SetPlayerColor(playerid,playerColors[playerid]);
    AutoRepairUsed[playerid] = 0;
    AutoRepairTrigger[playerid] = 0;
    SpawnPlayer(playerid);
    gTeam[playerid] = TEAM_NOTH;
    SendClientMessage(playerid,green,"Leave the deathmatch zone");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)