SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/01/2020, 08:44 AM   #1
Malembe
Little Clucker
 
Join Date: Jan 2020
Posts: 17
Reputation: 0
Default No ping after login

Hey, so, before login everything is ok but when I spawn in my server, my ping drop to 0ms and I can do nothing on the server. Need help please. Maybe something is wrong in my code.

(PS : I didn't know where I have to post it, so I posted here)



Code :

Code:
public OnPlayerConnect(playerid)
{


///---------------
    AntiFlood_InitPlayer( playerid );
    /// AFK
    PPos[playerid][0] = 0;
	PPos[playerid][1] = 0;
	PPos[playerid][2] = 0;
	AFKMins[playerid] = 0;
	/// FIN AFK
	Textdraw52[playerid] = TextDrawCreate(494.000000, 81.000000, " "); // money changes
	TextDrawAlignment(Textdraw52[playerid], 3);
	TextDrawBackgroundColor(Textdraw52[playerid], 255);
	TextDrawFont(Textdraw52[playerid], 1);
	TextDrawLetterSize(Textdraw52[playerid], 0.279999, 1.600000);
	TextDrawColor(Textdraw52[playerid], 0xFFFFFFFF);
	TextDrawSetOutline(Textdraw52[playerid], 1);
	TextDrawSetProportional(Textdraw52[playerid], 1);
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
    new astring[256];
    if(IsPlayerNPC(playerid)) return 1;
    SetTimer("PingKick", 60000, true);
    format(astring, sizeof(astring), "(( [%i] %s à rejoint Slowly Roleplay ))",playerid, plname);
   	SendClientMessageToAll(COLOR_YELLOW, astring);
	//AFKMin[playerid] = 0;
	Objet[playerid] = -1; //Le joueur n'a pas d'objet
	InShamal[playerid] = 0;
	//playerspeedtimer[playerid] = SetTimerEx("VehicleSpeed", 100, 1, "i", playerid);
	burnout[playerid]=0;
	gPlayerUsingLoopingAnim[playerid] = 0;
    gPlayerAnimLibsPreloaded[playerid] = 0;
 	LastHealth[playerid] = NULL;
 	SetTimer("scoreupdate", 60000, 1);
  	LastSpeed[playerid] = NULL;
  	new sendername[MAX_PLAYER_NAME];
  	GetPlayerName(playerid, sendername, sizeof(sendername));
  	PlayerPos[playerid][0] = 0; PlayerPos[playerid][1] = 0; PlayerPos[playerid][2] = 0;
	PompeEssence[playerid] = 255;
	TableauActive[playerid] = 1;
	EnPanne[playerid] = 0;
	EchangeVeh[playerid][0] = 255; EchangeVeh[playerid][1] = 0; EchangeVeh[playerid][2] = 0;
	#if defined USE_MENU
		DefinirPrix[playerid] = 0;
		DefinirEssence[playerid] = 0;
	#endif
Malembe is offline   Reply With Quote
Old 19/01/2020, 09:11 AM   #2
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 363
Reputation: 17
Default Re: No ping after login

Quote:
Originally Posted by Malembe View Post
Hey, so, before login everything is ok but when I spawn in my server, my ping drop to 0ms and I can do nothing on the server. Need help please. Maybe something is wrong in my code.

(PS : I didn't know where I have to post it, so I posted here)



Code :

Code:
public OnPlayerConnect(playerid)
{


///---------------
    AntiFlood_InitPlayer( playerid );
    /// AFK
    PPos[playerid][0] = 0;
	PPos[playerid][1] = 0;
	PPos[playerid][2] = 0;
	AFKMins[playerid] = 0;
	/// FIN AFK
	Textdraw52[playerid] = TextDrawCreate(494.000000, 81.000000, " "); // money changes
	TextDrawAlignment(Textdraw52[playerid], 3);
	TextDrawBackgroundColor(Textdraw52[playerid], 255);
	TextDrawFont(Textdraw52[playerid], 1);
	TextDrawLetterSize(Textdraw52[playerid], 0.279999, 1.600000);
	TextDrawColor(Textdraw52[playerid], 0xFFFFFFFF);
	TextDrawSetOutline(Textdraw52[playerid], 1);
	TextDrawSetProportional(Textdraw52[playerid], 1);
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
    new astring[256];
    if(IsPlayerNPC(playerid)) return 1;
    SetTimer("PingKick", 60000, true);
    format(astring, sizeof(astring), "(( [%i] %s à rejoint Slowly Roleplay ))",playerid, plname);
   	SendClientMessageToAll(COLOR_YELLOW, astring);
	//AFKMin[playerid] = 0;
	Objet[playerid] = -1; //Le joueur n'a pas d'objet
	InShamal[playerid] = 0;
	//playerspeedtimer[playerid] = SetTimerEx("VehicleSpeed", 100, 1, "i", playerid);
	burnout[playerid]=0;
	gPlayerUsingLoopingAnim[playerid] = 0;
    gPlayerAnimLibsPreloaded[playerid] = 0;
 	LastHealth[playerid] = NULL;
 	SetTimer("scoreupdate", 60000, 1);
  	LastSpeed[playerid] = NULL;
  	new sendername[MAX_PLAYER_NAME];
  	GetPlayerName(playerid, sendername, sizeof(sendername));
  	PlayerPos[playerid][0] = 0; PlayerPos[playerid][1] = 0; PlayerPos[playerid][2] = 0;
	PompeEssence[playerid] = 255;
	TableauActive[playerid] = 1;
	EnPanne[playerid] = 0;
	EchangeVeh[playerid][0] = 255; EchangeVeh[playerid][1] = 0; EchangeVeh[playerid][2] = 0;
	#if defined USE_MENU
		DefinirPrix[playerid] = 0;
		DefinirEssence[playerid] = 0;
	#endif
Looks like there's more of the OnPlayerConnect that's been cut off. Could you possibly show us that?
__________________
Developer @ Trucknation
Administrator & Developer @ Lost Legacy
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
Proxus is offline   Reply With Quote
Old 19/01/2020, 09:15 AM   #3
Malembe
Little Clucker
 
Join Date: Jan 2020
Posts: 17
Reputation: 0
Default Re: No ping after login

Quote:
Originally Posted by Proxus View Post
Looks like there's more of the OnPlayerConnect that's been cut off. Could you possibly show us that?
Yep.

Code:
public OnPlayerConnect(playerid)
{


///---------------
    AntiFlood_InitPlayer( playerid );
    /// AFK
    PPos[playerid][0] = 0;
	PPos[playerid][1] = 0;
	PPos[playerid][2] = 0;
	AFKMins[playerid] = 0;
	/// FIN AFK
	Textdraw52[playerid] = TextDrawCreate(494.000000, 81.000000, " "); // money changes
	TextDrawAlignment(Textdraw52[playerid], 3);
	TextDrawBackgroundColor(Textdraw52[playerid], 255);
	TextDrawFont(Textdraw52[playerid], 1);
	TextDrawLetterSize(Textdraw52[playerid], 0.279999, 1.600000);
	TextDrawColor(Textdraw52[playerid], 0xFFFFFFFF);
	TextDrawSetOutline(Textdraw52[playerid], 1);
	TextDrawSetProportional(Textdraw52[playerid], 1);
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
    new astring[256];
    if(IsPlayerNPC(playerid)) return 1;
    SetTimer("PingKick", 60000, true);
    format(astring, sizeof(astring), "(( [%i] %s à rejoint Slowly Roleplay ))",playerid, plname);
   	SendClientMessageToAll(COLOR_YELLOW, astring);
	//AFKMin[playerid] = 0;
	Objet[playerid] = -1; //Le joueur n'a pas d'objet
	InShamal[playerid] = 0;
	//playerspeedtimer[playerid] = SetTimerEx("VehicleSpeed", 100, 1, "i", playerid);
	burnout[playerid]=0;
	gPlayerUsingLoopingAnim[playerid] = 0;
    gPlayerAnimLibsPreloaded[playerid] = 0;
 	LastHealth[playerid] = NULL;
 	SetTimer("scoreupdate", 60000, 1);
  	LastSpeed[playerid] = NULL;
  	new sendername[MAX_PLAYER_NAME];
  	GetPlayerName(playerid, sendername, sizeof(sendername));
  	PlayerPos[playerid][0] = 0; PlayerPos[playerid][1] = 0; PlayerPos[playerid][2] = 0;
	PompeEssence[playerid] = 255;
	TableauActive[playerid] = 1;
	EnPanne[playerid] = 0;
	EchangeVeh[playerid][0] = 255; EchangeVeh[playerid][1] = 0; EchangeVeh[playerid][2] = 0;
	#if defined USE_MENU
		DefinirPrix[playerid] = 0;
		DefinirEssence[playerid] = 0;
	#endif
	#if defined USE_CALLCAR
		for(new c=0;c<MAX_PLAYER_VEHICLES;c++)
		{
		    MyVehicleID[playerid][c] = 0;
		}
	#endif
	for(new m=0;m<sizeof(Pompe);m++)
	{
		SetPlayerMapIcon(playerid,m,Pompe[m][0],Pompe[m][1],Pompe[m][2],51,1);
	}
 	if (Objet[playerid]  != -1)
    {
        DestroyStreamObject (Objet[playerid]);
        Objet[playerid] = -1;
    /*}
	for(new p=0;p<sizeof(AFKPos[]);p++)
	{
	    AFKPos[playerid][p] = 0;*/
	}
	if(Security != 0)
	{
	    SendClientMessage(playerid, COLOR_YELLOW, "Host has broken one of the Agreement rules, action has been taken.");
	    Kick(playerid);
	    return 1;
	}
    new namestring = strfind(plname, "_", true);
 	if(namestring == -1)
	{
        new string[256];
		SendClientMessage(playerid, COLOR_YELLOW2, "Département d'immigration: Votre nom n'est pas acceptable.");
		SendClientMessage(playerid, COLOR_YELLOW2, "Info: Votre nom doit réspécté la forme Prénom_Nom. (Exemple : Thomas_Dupont)");
		format(string,sizeof(string),"[ANTI-NORP]: %s a été kické pour nom NO-RP.",sendername);
		SendClientMessageToAll(COLOR_RED,string);
		Kick(playerid);
		return 1;
	}
	new BadNameChars[][2] = {"/","`","~","!","@","#","$","%","^","&","","(",")","-","=","+",".",",","<",">","[","]","{","}","|",":",";","'","0","1","2","3","4","5","6","7","8","9","°"};
	for(new i=0;i<sizeof(BadNameChars);i++)
	{
		if(strfind(sendername,BadNameChars[i],true) != -1 || strlen(sendername) > MAX_PLAYERS)
		{
		new string[256];
		SendClientMessage(playerid, COLOR_YELLOW2, "Département d'immigration: Votre nom n'est pas acceptable. (Caractères interdits)");
		SendClientMessage(playerid, COLOR_YELLOW2, "Info: Votre nom doit réspécté la forme Prénom_Nom. (Exemple : Thomas_Dupont)");
		format(string,sizeof(string),"[ANTI-NORP]: %s a été kické pour nom NO-RP.",sendername);
        SendClientMessageToAll(COLOR_RED,string);
		Kick(playerid);
		return 1;
		}
    }
    if (strlen(sendername) < 5)
	{
        new string[256];
		SendClientMessage(playerid, COLOR_YELLOW2, "Département d'immigration: Votre nom n'est pas acceptable. (Trop court)");
		SendClientMessage(playerid, COLOR_YELLOW2, "Info: Votre nom doit réspécté la forme Prénom_Nom. (Exemple : Thomas_Dupont)");
		format(string,sizeof(string),"[ANTI-NORP]: %s a été kické pour nom NO-RP.",sendername);
		SendClientMessageToAll(COLOR_RED,string);
		Kick(playerid);
		return 1;
(Sorry it's a French Script, if you don't understand something, tell me I will translate)
Malembe is offline   Reply With Quote
Old 19/01/2020, 03:24 PM   #4
Malembe
Little Clucker
 
Join Date: Jan 2020
Posts: 17
Reputation: 0
Default Re: No ping after login

Help please.
Malembe is offline   Reply With Quote
Old 19/01/2020, 03:31 PM   #5
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 363
Reputation: 17
Default Re: No ping after login

Quote:
Originally Posted by Malembe View Post
Help please.
I mean, I can't see the bottom of your script (at the end of OnPlayerConnect). However, have you returned a value at the end of OnPlayerConnect? I don't think it would error, only give a warning- which you may have missed.
__________________
Developer @ Trucknation
Administrator & Developer @ Lost Legacy
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
Proxus is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] San Andreas Essentials: ePing | Freeze Player With High Ping | Anti-High Ping | billy1337samp Filterscripts 11 23/11/2017 07:04 AM
[FilterScript] Very Easy Anti-Ping And Ping TextDraw giorgosdim12 Filterscripts 10 23/11/2017 06:27 AM
IP & PING Retruns me same ping as player which executes the command MiGu3X Scripting Help 3 30/03/2013 01:11 AM
Ping Maelstrom Client Support 5 06/02/2011 07:27 AM


All times are GMT. The time now is 06:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.