29.06.2016, 23:46
Hello, I'm trying to get an Admins command working, but I'd like to be able to /setlevel and to be able to view online Administrators.
So far, I've got this command that causes errors in my gamemode, I've had a look around and I'm just confusing myself with probably, for most a very simple task. If someone could take a look at my code I'd greatly appreciate that.
It also kicks out these errors:
Thanks in advance to those who help.
So far, I've got this command that causes errors in my gamemode, I've had a look around and I'm just confusing myself with probably, for most a very simple task. If someone could take a look at my code I'd greatly appreciate that.
Код:
cmd(admins, playerid, params[])
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_ADMIN, "Online Staff Members:");
new count; new ID; new admtext[64];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new sendername[MAX_PLAYER_NAME];
switch(Player_LoadInt("AdminLevel");
case 1: format(admtext, 64, "{10F441}Beta Tester");
case 2: format(admtext, 64, "{10F441}Moderator");
case 3: format(admtext, 64, "{33AA33}Administrator");
case 4: format(admtext, 64, "{FF0000}Senior Administrator");
case 1337: format(admtext, 64, "{FF0000}Head Administrator");
default: continue;
}
GetPlayerName(i, sendername, sizeof(sendername));
new tstr[128];
format(tstr, 128, "%s(%d) - %s", sendername, ID, admtext);
SendClientMessage(playerid, -1, tstr);
format(admtext, 64, "");
count++;
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_ERROR, "No online administrators found.");
return 1;
}
}
}
return 1;
}
Код:
C:\Users\Tom\Desktop\SAMP Server\gamemodes\newgm.pwn(363) : error 017: undefined symbol "Player_LoadInt" C:\Users\Tom\Desktop\SAMP Server\gamemodes\newgm.pwn(363) : error 001: expected token: ")", but found ";" C:\Users\Tom\Desktop\SAMP Server\gamemodes\newgm.pwn(364) : error 014: invalid statement; not in switch C:\Users\Tom\Desktop\SAMP Server\gamemodes\newgm.pwn(364) : warning 215: expression has no effect C:\Users\Tom\Desktop\SAMP Server\gamemodes\newgm.pwn(364) : error 001: expected token: ";", but found ":" C:\Users\Tom\Desktop\SAMP Server\gamemodes\newgm.pwn(364) : error 029: invalid expression, assumed zero C:\Users\Tom\Desktop\SAMP Server\gamemodes\newgm.pwn(364) : fatal error 107: too many error messages on one line

