SA-MP Forums Archive
Ping Limit - 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: Ping Limit (/showthread.php?tid=187662)



Ping Limit - HotRod - 04.11.2010

Ok, i've got stuck and i don't think i've done this right.

I'm new with pawn scripting and learnt alot of the beginner stuff in a very short time.

I need help with if someone had over 500 ping to kick them.

I have this under onplayerconnect:

Quote:

new playerping = GetPlayerPing(playerid);
if playerping => 500

But i think that's totaly wrong. If it's not do you know what i should do after that.


Re: Ping Limit - willsuckformoney - 04.11.2010

pawn Код:
public OnPlayerConnect(playerid)
{
        new pPing = GetPlayerPing(playerid);
        if(pPing => 500) return Kick(playerid);
        return 1;
}



Re: Ping Limit - bigcomfycouch - 04.11.2010

http://pastebin.com/3tRSQF5Q


Re: Ping Limit - HotRod - 04.11.2010

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
pawn Код:
public OnPlayerConnect(playerid)
{
        new pPing = GetPlayerPing(playerid);
        if(pPing => 500) return Kick(playerid);
        return 1;
}

I've tryed to put that under my welcome message.

But i got errors
Quote:

C:\Users\Lewis\Desktop\ALLGTA\*\gamemodes\DizzysTe stScript.pwn(64) : warning 217: loose indentation
C:\Users\Lewis\Desktop\ALLGTA\*\gamemodes\DizzysTe stScript.pwn(65) : warning 211: possibly unintended assignment
C:\Users\Lewis\Desktop\ALLGTA\*\gamemodes\DizzysTe stScript.pwn(65) : error 029: invalid expression, assumed zero
C:\Users\Lewis\Desktop\ALLGTA\*\gamemodes\DizzysTe stScript.pwn(65) : warning 215: expression has no effect
C:\Users\Lewis\Desktop\ALLGTA\*\gamemodes\DizzysTe stScript.pwn(65) : error 001: expected token: ";", but found ")"
C:\Users\Lewis\Desktop\ALLGTA\*\gamemodes\DizzysTe stScript.pwn(65) : error 029: invalid expression, assumed zero
C:\Users\Lewis\Desktop\ALLGTA\*\gamemodes\DizzysTe stScript.pwn(65) : fatal error 107: too many error messages on one line

And this is what i got:

Quote:

public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, RED, "Welcome");

new pPing = GetPlayerPing(playerid);
if(pPing => 500) return Kick(playerid);
return 1;

return 1;
}

Also i would like to sendclientmessage before they get kicked saying they exceeded the ping limit.


Re: Ping Limit - Cameltoe - 04.11.2010

pawn Код:
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, RED, "Welcome");
if(GetPlayerPing(playerid) => 500)
{
     SendClientMessage(playerid, RED, "Kicked due to: Ping exceeded.");
     return Kick(playerid);
}
return 1;
}



Re: Ping Limit - HotRod - 04.11.2010

Ok, i've got this as my onplayerconnect:

Quote:

public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, RED, "Welcome");
if(GetPlayerPing(playerid) => 500)
{
SendClientMessage(playerid, RED, "Kicked due to: Ping exceeded.");
return Kick(playerid);
}
return 1;
}

Error is:
Quote:

C:\Users\Lewis\Desktop\ALLGTA\Beginnerscript 2\gamemodes\DizzysTestScript.pwn(63) : warning 211: possibly unintended assignment
C:\Users\Lewis\Desktop\ALLGTA\Beginnerscript 2\gamemodes\DizzysTestScript.pwn(63) : error 022: must be lvalue (non-constant)
C:\Users\Lewis\Desktop\ALLGTA\Beginnerscript 2\gamemodes\DizzysTestScript.pwn(63) : error 029: invalid expression, assumed zero
C:\Users\Lewis\Desktop\ALLGTA\Beginnerscript 2\gamemodes\DizzysTestScript.pwn(63) : warning 215: expression has no effect
C:\Users\Lewis\Desktop\ALLGTA\Beginnerscript 2\gamemodes\DizzysTestScript.pwn(63) : error 001: expected token: ";", but found ")"
C:\Users\Lewis\Desktop\ALLGTA\Beginnerscript 2\gamemodes\DizzysTestScript.pwn(63) : fatal error 107: too many error messages on one line

And line 63 is:

Quote:

if(GetPlayerPing(playerid) => 500)

Any solution or is it fucked up o.O


Re: Ping Limit - Miguel - 04.11.2010

"=>" should be ">=".

So:
pawn Код:
if(GetPlayerPing(playerid) >= 500) // This has been changed.



Re: Ping Limit - woot - 04.11.2010

I don't belive it'll work correctly in OnPlayerConnect - pings may always change. I would put it into a timer.


Re: Ping Limit - Retardedwolf - 04.11.2010

During OPC a player will recieve 65535 ping at first so you need to wait at least 1 minute or so to let the ping turn into a correct one.


Re: Ping Limit - TheGuardianAngel - 04.11.2010

Quote:
Originally Posted by bigcomfycouch
Посмотреть сообщение
this is good