Quote:
Originally Posted by Criss_Angel
Код:
C:\Users\Administrator\Documents\SAMP 0.3a\gamemodes\erp.pwn(1502) : warning 217: loose indentation
C:\Users\Administrator\Documents\SAMP 0.3a\gamemodes\erp.pwn(16198) : warning 217: loose indentation
C:\Users\Administrator\Documents\SAMP 0.3a\gamemodes\erp.pwn(26226) : warning 235: public function lacks forward declaration (symbol "OnPlayerPrivmsg")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Header size: 5988 bytes
Code size: 1097304 bytes
Data size: 4426132 bytes
Stack/heap size: 16384 bytes; estimated max. usage=5103 cells (20412 bytes)
Total requirements: 5545808 bytes
3 Warnings.
just some minor indention errors
|
And a lack of forward declaration. Use:
pawn Код:
forward OnPlayerPrivmsg(playerid, toplayerid, cmdtext[])
Or something like this. Idk if there is a toplayerid, or something like that, just check how your callback looks like. I don't know if this effects the functionality, but you should also fix the indentation warnings.
If you care, mine looks like this:
pawn Код:
cmd_admins(playerid)
{
new admincount=0;
new hidden=0;
for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)
{
if(IsPlayerConnected(i)&&IsPlayerLoggedIn(i)&&IsAdminAtLeast(i,1))
{
admincount++;
if(GetPVarInt(i, "AdminHidden")==1)hidden++;
}
}
if(admincount!=0&&admincount!=hidden)
{
new ames[50];
SendClientMessage(playerid, COLOR_GREEN, "");
if(admincount==1)format(ames, sizeof(ames), "There is %i Admin online.(Hidden: %i)", admincount, hidden);
else format(ames, sizeof(ames), "There are %i Admins online.(Hidden: %i)", admincount, hidden);
SendClientMessage(playerid, COLOR_GREEN, ames);
SendClientMessage(playerid, COLOR_GREEN, "");
SendClientMessage(playerid, COLOR_GREEN, "########ADMINS########");
for(new i=0, tx=GetMaxPlayers(); i<=tx; i++)
{
if(IsPlayerConnected(i)&&IsPlayerLoggedIn(i)&&IsAdminAtLeast(i,1)&&GetPVarInt(i, "AdminHidden")!=1)
{
new adname[MAX_PLAYER_NAME],adetmes[50];
GetPlayerName(i, adname, sizeof(adname));
format(adetmes, sizeof(adetmes), "Name: %s | Level: %i", adname, GetPlayerAdminLevel(i));
SendClientMessage(playerid, COLOR_GREEN, adetmes);
}
}
SendClientMessage(playerid, COLOR_GREEN, "#######################");
}
else if(admincount==hidden&&admincount!=0)
{
new ames[50];
if(admincount==1)format(ames, sizeof(ames), "There is %i Admin online.(Hidden: %i)", admincount, hidden);
else format(ames, sizeof(ames), "There are %i Admins online.(Hidden: %i)", admincount, hidden);
SendClientMessage(playerid, COLOR_GREEN, ames);
}
else
{
SendClientMessage(playerid, COLOR_GREEN, "There is 1 Admin online. (Hidden: 1)");
}
return 1;
}
And the commands to hide yourself:
pawn Код:
cmd_adminhide(playerid)
{
SetPVarInt(playerid, "AdminHidden", 1);
SendClientMessage(playerid, COLOR_GREEN, "You have successfully hidden your Admin level.");
return 1;
}
cmd_adminshow(playerid)
{
SetPVarInt(playerid, "AdminHidden", 0);
SendClientMessage(playerid, COLOR_GREEN, "You have successfully shown your Admin level.");
return 1;
}
Don't wonder, it automatically shows one admin, even if none is online. That's for hack-prevention, cuz most hackers just hack if no admin is online, i've noticed.