Dialog not being called @ OnPlayerConnect:
#1

I'm using a modullar script. The following excerpt of OnPlayerConnect is part of Callbacks.pwn, which is included in Main.pwn.

pawn Код:
public OnPlayerConnect(playerid)
{
    new PLAYER_NAME[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PLAYER_NAME, sizeof(PLAYER_NAME));
   
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
    }
    return 1;
}
Yet, for some reason, these dialogs do not show up in-game, and I'm not sure what the problem is.
Reply
#2

add a debug message at the top of OnPlayerConnect (if you didn't already),
just 2 check if OnPlayerConnect really isn't being called.


works fine 4 me with OnPlayerConnect, i did it like this:
pawn Код:
//main.pwn
#include <a_samp>

#include "callbacks.pwn"

main(){}

public OnGameModeInit()
{

    return 1;
}
//----------------
//callbacks.pwn
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid,-1,"sup!");
    return 1;
}
i do get that "sup!" when i connect
Reply
#3

I added a debug message and it did not show at the console.

pawn Код:
#include <a_samp>

main()
{
}

/* Includes */
/* INIT GAMEMODE */
#include "../gamemodes/Folder/Gamemode/Enums.pwn"
#include "../gamemodes/Folder/Gamemode/Definitions.pwn"
#include "../gamemodes/Folder/Gamemode/Stocks.pwn"
#include "../gamemodes/Folder/Gamemode/Functions.pwn"
#include "../gamemodes/Folder/Gamemode/Callbacks.pwn"

//Callbacks.pwn
public OnPlayerConnect(playerid)
{
    print("OnPlayerConnect callback is being called successfully.");
    new PLAYER_NAME[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PLAYER_NAME, sizeof(PLAYER_NAME));
   
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by Twizted
Посмотреть сообщение
I added a debug message and it did not show at the console.
now that's weird...
seems like that pwn isn't getting included at all.

try this, comment all the other modules except of the callbacks.pwn
and see if the debug msg shows.
you might've messed up somewhere in the other scripts

you could also try including callbacks.pwn as 1st module and then load all the others.
if the msg shows after this, then you messed up somewhere in one of the other scripts


btw. you have to recompile the main.pwn when you edit a module as these aren't like filterscripts.
the contents of these modules get added to main.pwn where you "#include" ed them before actual compilation.
meaning you can't edit them without recompiling your main.pwn
But i bet you already knew that, just in case.
Reply
#5

The following link leads to my Main.pwn file:http://pastebin.com/QrbWnsap

These are my includes: Callbacks.pwn has got to be the last included as far as I know, else Main.pwn won't compile properly.
Reply
#6

Quote:
Originally Posted by Twizted
Посмотреть сообщение
The following link leads to my Main.pwn file:http://pastebin.com/QrbWnsap

These are my includes: Callbacks.pwn has got to be the last included as far as I know, else Main.pwn won't compile properly.
ok i set everything up and found some errors

- stocks.pwn
pawn Код:
stock Path(playerid)
    new str[128],name[MAX_PLAYER_NAME];
//...
should be:
pawn Код:
stock Path(playerid)
{//bracket was missing
    new str[128],name[MAX_PLAYER_NAME];
//...
-Definitions.pwn
pawn Код:
#define UserPath "TWI/Users/%.ini"//'s' is missing
should be:
pawn Код:
#define UserPath "TWI/Users/%s.ini"
after i fexed those, it worked fine, got the debug msg and saw ur dialog
and a file whit my username has been created in TWI/Users
Код:
[join] East_Crips has joined the server (0:12
OnPlayerConnect callback is being called successfully
[part] East_Crips has left the server (0:2)
Reply
#7

Would you care not too much to give a practical example than just repeating the quote you always seem to write whenever you see a "modular" script? Enlighten me on how I should organize my gamemode instead of just writing a cool, smart paragraph. It's not possible to obtain knowledge on a matter if no one gives you a pratical example.

How should I sort the script?
Reply
#8

you could take Southclaws Scavenge and survive as example
it's really stunning & impressive GM

https://github.com/Southclaw/ScavengeSurvive

that's professional shit xD
really... when i first saw that.. i was like.. "what the..."
its just awesome
Reply
#9

Quote:
Originally Posted by CutX
Посмотреть сообщение
you could take Southclaws Scavenge and survive as example
it's really stunning & impressive GM

https://github.com/Southclaw/ScavengeSurvive

that's professional shit xD
really... when i first saw that.. i was like.. "what the..."
its just awesome
He's linked me to it, I'll definitely check it out throughout the construction of the gamemode. It is indeed a great piece of work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)