Ping Limit
#1

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.
Reply
#2

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

http://pastebin.com/3tRSQF5Q
Reply
#4

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.
Reply
#5

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;
}
Reply
#6

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
Reply
#7

"=>" should be ">=".

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

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

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 3 Guest(s)