SA-MP Forums Archive
adminduty zcmd help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: adminduty zcmd help (/showthread.php?tid=267610)



adminduty zcmd help - Bu$ter - 09.07.2011

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


Re: adminduty zcmd help - PrawkC - 09.07.2011

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


Re: adminduty zcmd help - Bu$ter - 09.07.2011

Yeah man thats working thanks