SA-MP Forums Archive
How do I? - 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: How do I? (/showthread.php?tid=316227)



How do I? - seanny - 05.02.2012

Hello, I have been getting a few problems with OnPlayerConnect not being called, Why is this?

Is there an error with the following code? This error is really getting on my nerves.

pawn Код:
public OnPlayerConnect(playerid)
{
    gPlayerLogged[playerid] == 0;
    TogglePlayerControllable(playerid,0);
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}



Re: How do I? - Vince - 05.02.2012

For one, you should get an error along the lines of 'invalid function or declaration'.
pawn Код:
gPlayerLogged[playerid] == 0;
Single equation symbol means assignment, double equation symbol means comparison.


Re: How do I? - seanny - 05.02.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
For one, you should get an error along the lines of 'invalid function or declaration'.
pawn Код:
gPlayerLogged[playerid] == 0;
Single equation symbol means assignment, double equation symbol means comparison.
But everytime I try to login to my Test server using this script, OnPlayerConnect is like ignored by the server, I am asking why that is?


Re: How do I? - Vince - 05.02.2012

Read my post again. Especially the last line! General rule of thumb is: do NOT run a script if it compiled with warnings! (There are about two warnings that can be safely ignored, but that's irrelevant here.)


Re: How do I? - seanny - 05.02.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
Read my post again. Especially the last line! General rule of thumb is: do NOT run a script if it compiled with warnings! (There are about two warnings that can be safely ignored, but that's irrelevant here.)
I did as you said, But OnPlayerConnect is still not getting called by the Server, I am asking why?


Re: How do I? - Cameltoe - 05.02.2012

Quote:
Originally Posted by seanny
Посмотреть сообщение
I did as you said, But OnPlayerConnect is still not getting called by the Server, I am asking why?
Let us see the server.cfg


Re: How do I? - seanny - 05.02.2012

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
Let us see the server.cfg
Код:
echo Executing Server Config...
lanmode 0
rcon_password ******
maxplayers 5
port 7777
hostname Sean_Mcelholm's Localhost
gamemode0 san-rp 1
filterscripts ls_elevator
plugins streamer sscanf
announce 1
query 1
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 70



Re: How do I? - Cameltoe - 05.02.2012

Try removing the filterscript.

And do test's like :

pawn Код:
public OnPlayerConnect(playerid)
{

    print("OnPlayerConnect part 1 : Called");
    gPlayerLogged[playerid] == 0;
    print("OnPlayerConnect part 2 : Called");
    TogglePlayerControllable(playerid,0);
    print("OnPlayerConnect part 3 : Called");
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
         print("OnPlayerConnect part UserCheckExists : Called");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
         print("OnPlayerConnect part UserCheckNotExists : Called");
    }
    print("OnPlayerConnect part 4 : Called");
    return 1;
}
And tell us what the server console outputs.


Re: How do I? - seanny - 05.02.2012

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
Try removing the filterscript.

And do test's like :

pawn Код:
public OnPlayerConnect(playerid)
{

    print("OnPlayerConnect part 1 : Called");
    gPlayerLogged[playerid] == 0;
    print("OnPlayerConnect part 2 : Called");
    TogglePlayerControllable(playerid,0);
    print("OnPlayerConnect part 3 : Called");
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
         print("OnPlayerConnect part UserCheckExists : Called");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
         print("OnPlayerConnect part UserCheckNotExists : Called");
    }
    print("OnPlayerConnect part 4 : Called");
    return 1;
}
And tell us what the server console outputs.
Did that, It just outputs the same as before. OnPlayerConnect does not get called


Re: How do I? - Cameltoe - 05.02.2012

Then im not sure, as far as i can see .. i may be blind, but it should work properly. Try re-downloading the latest source of sa-mp and overwriting existing ones. Perhaps there is something with your includes etc?