adminduty zcmd help
#1

Hi all. Could somebody help to fix this cmd:

pawn Код:
CMD:adminduty(playerid, params[])
{
 new string[64];
 if (PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You can't use this command!");
 if (PlayerInfo[playerid][pAdminLevel] <= 3) return SendClientMessage(playerid, 0x868479FF, "TIP: Use /modduty to go on duty!");
 {
    format(string, sizeof(string), "ADMINDUTY: You are now admin on duty! (Your adminlevel is %s) ", pAdminLevel);
    SendClientMessage(playerid, 0x00FF00FF, string);
    PlayerInfo[playerid][pAdminDuty] = 1;
}
else
{
PlayerInfo[playerid][pAdminDuty] = 0;
SendClientMessage(playerid, 0x00FF00FF, "ADMINDUTY: You are now admin off-duty!");
}
return 1;
}
It returns one error:
pawn Код:
error 029: invalid expression, assumed zero
Error line is "else"

Thx
Reply
#2

An if has to come before the else .. as vague as my explanation is, you should be able to understand.

pawn Код:
CMD:adminduty(playerid, params[])
{
 new string[64];
 if (PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You can't use this command!");
 if (PlayerInfo[playerid][pAdminLevel] > 0) return SendClientMessage(playerid, 0x868479FF, "TIP: Use /modduty to go on duty!");
 if(PlayerInfo[playerid][pAdminDuty] == 0)
 {
    format(string, sizeof(string), "ADMINDUTY: You are now admin on duty! (Your adminlevel is %d) ", PlayerInfo[playerid][pAdminLevel]);
    SendClientMessage(playerid, 0x00FF00FF, string);
    PlayerInfo[playerid][pAdminDuty] = 1;
 }
 else
 {
    PlayerInfo[playerid][pAdminDuty] = 0;
    SendClientMessage(playerid, 0x00FF00FF, "ADMINDUTY: You are now admin off-duty!");
 }
 return 1;
}
Edit:" looked at it a bit more, yeah its pretty messed up, this should work. but not sure its late and I'm not at home
Reply
#3

Yeah man thats working thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)