Posts: 60
Threads: 11
Joined: Oct 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.
Posts: 60
Threads: 11
Joined: Oct 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.
Posts: 60
Threads: 11
Joined: Oct 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
Posts: 785
Threads: 22
Joined: Jun 2007
Reputation:
0
I don't belive it'll work correctly in OnPlayerConnect - pings may always change. I would put it into a timer.
Posts: 1,466
Threads: 7
Joined: Jun 2009
Reputation:
0
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.