SA-MP Forums Archive
Npc Leaving after a while time ' 15 sec ' - 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)
+--- Thread: Npc Leaving after a while time ' 15 sec ' (/showthread.php?tid=469962)



Npc Leaving after a while time ' 15 sec ' - BigBaws - 15.10.2013

OnPlayerConnect

Код:
public OnPlayerConnect(playerid)   // Quand le joueur ce connecte.
{
    if(IsPlayerRNPC(playerid))
    {
        SpawnPlayer(playerid);
    }
    else
    {
	new phrase[256];
    GetPlayerName(playerid,Nom,sizeof Nom);
    format(phrase,sizeof phrase,""C_Blanc"%s "C_BleuSamp"vient de rejoindre la ville.",Nom);
    SendClientMessageToAll(JAUNE,phrase);
    
    new Charger[35];
    new requete[32];
	GetPlayerName(playerid, Nom, sizeof(Nom));
    format(requete, sizeof(requete), "SELECT * FROM rp_compte_lier WHERE LOWER(NomJoueur)=LOWER('%s') LIMIT 1", Nom);
    mysql_query(requete);
    mysql_store_result();
    while(mysql_fetch_row_format(requete,"|"))
    {
        mysql_fetch_field_row(Charger, "PremiereCo");ConnexionOne[playerid] = strval(Charger);
	}
and this is the msg i get before the npc left :

OnplayerConnect Hook has Called
After 10 sec i get this
ARNPC Debug : OnPlayerDisconnect Hook has Called

Thank you to get me an answer


Re: Npc Leaving after a while time ' 15 sec ' - Konstantinos - 15.10.2013

pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    // rest of code
    return 1;
}
and if the type is not for vehicles, it's not necessary to use OnPlayerSpawn callback.