How do I?
#1

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

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

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

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

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)