Can someone see a error here - 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: Can someone see a error here (
/showthread.php?tid=110288)
Can someone see a error here -
Striker_Moe - 25.11.2009
Been wondering, you dont get kicked if youґre using a reserved slot.
Do you see some error here?
Код:
#define SERVERSLOTS 50
#define RESERVEDSLOTS 5
Код:
if(connected >= (SERVERSLOTS-RESERVEDSLOTS) && reserver[playerid] < 1)
{
new string[128];
SendClientMessage(playerid,RED,"SERVER: You have been kicked for using a reserved slot.");
format(string, sizeof(string), "SERVER: %d slots of total %d slots are reserved, %d slots currently used.",RESERVEDSLOTS,SERVERSLOTS,connected);
SendClientMessageToAll(RED, string);
Kick(playerid);
}
else
{
connected++;
}
Код:
public OnPlayerDisconnect(playerid, reason)
{
connected--;
reserver[playerid] = 0;
return 1;
}
Re: Can someone see a error here -
Joe Staff - 25.11.2009
Would probably be easier if you just did this
pawn Код:
public OnPlayerConnect(playerid)
{
new tmpamount;
for(new o;o<MAX_PLAYERS;o++)if(IsPlayerConnected(o))tmpamount++;
if(tmpamount>(SERVERSLOTS-RESERVEDSLOTS))Kick(playerid);
return 1;
}
That should work.