Little help with onplayerconnect
#1

How i can make when any player connect first to show him the dialog with with rules.
This is my on player connect:

PHP код:
public OnPlayerConnect(playerid)
{
    new 
string[MAX_PLAYER_NAME];
    
ResetStats(playerid);
    
//police
    
BigEar[playerid] = 0;
    
OnDuty[playerid] = 0;
    
JailPrice[playerid] = 0;
    
HelpEnabled[playerid] = true;
    
//=======================
    
Enabled[playerid]=0;
    
Pers[playerid]=0;
    
//MAP ICONS
    
SetPlayerMapIcon(playerid02495.6240,-1669.8031,13.335919, -1);
    if(!
dini_Exists(string))
    {
        
gPlayerAccount[playerid] = 0;
         new 
regstring[256];
        new 
regname[64];
        
SendClientMessage(playeridCOLOR_YELLOW"Ти нямаш акаунт. Моля, регистрирай твоя акаунт.");
        
GetPlayerName(playerid,regname,sizeof(regname));
        
format(regstring,sizeof(regstring),"{FFFFFF}[ B-U-L-G-A-R-I-A-N ]{80FF00}[ S-E-R-V-E-R]{FF0000}[0.3]\n{80FF00}Моля регистрирай твоя акаунт преди да се логнеш");
        
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_PASSWORD,"Регистрация:",regstring,"Регистрирай","Излез");
        return 
1;
    }
    else
    {
        
gPlayerAccount[playerid] = 1;
        new 
loginstring[256];
        new 
loginname[64];
        
SendClientMessage(playeridCOLOR_YELLOW"SERVER: Това име е регистрирано.");
        
SendClientMessage(playeridCOLOR_WHITE"HINT: Ти може да се логнеш като си въведеш паролата");
        
GetPlayerName(playerid,loginname,sizeof(loginname));
        
format(loginstring,sizeof(loginstring),"{FFFFFF}server{80FF00}server{FF0000}[0.3]\n{80FF00}Името е регистрирано. Моля, въведи твоята парола");
        
ShowPlayerDialog(playerid,12346,DIALOG_STYLE_PASSWORD,"Влизане:",loginstring,"Влез","Излез");
        return 
1;
    }

Reply
#2

Do you want the rules to show before or after they log in?
Reply
#3

Can you show the rules dialog code..
Reply
#4

Quote:
Originally Posted by Eric
Посмотреть сообщение
Do you want the rules to show before or after they log in?
Before they login
Reply
#5

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
Can you show the rules dialog code..
As he said, we need the rules dialog.
Reply
#6

show us a list of your rules...
Reply
#7

Or you can edit this code according to your needs
pawn Код:
ShowPlayerDialog(playerid, DIALOG_RULES/*name or id of dialog*/, DIALOG_STYLE_MSGBOX, "Rules", "Your rules here\nthis is the next line", "Ok", "Ok");
After editing it show it to us and we will put it in your script in the correct location
Reply
#8

PHP код:
ShowPlayerDialog(playerid5DIALOG_STYLE_LIST"Rules""Don't use any hack\nPlease dont spam in the chat\n Are you agree with yhe rules""Yes""No"); 
Reply
#9

Quote:
Originally Posted by boyan96
Посмотреть сообщение
PHP код:
ShowPlayerDialog(playerid5DIALOG_STYLE_LIST"Rules""Don't use any hack\nPlease dont spam in the chat\n Are you agree with yhe rules""Yes""No"); 
It's correct,but don't forget to define that dialog id.
Reply
#10

Ok.Change your code to
pawn Код:
public OnPlayerConnect(playerid)
{

    ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Rules", "Don't use any hack\nPlease dont spam in the chat\n Are you agree with the rules", "Yes", "No");  
    return 1;
}
Then in your OnDialogResponse
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 5)
    {
        if(response) {
        new string[MAX_PLAYER_NAME];
    ResetStats(playerid);
    //police
    BigEar[playerid] = 0;
    OnDuty[playerid] = 0;
    JailPrice[playerid] = 0;
    HelpEnabled[playerid] = true;
    //=======================
    Enabled[playerid]=0;
    Pers[playerid]=0;
    //MAP ICONS
    SetPlayerMapIcon(playerid, 0, 2495.6240,-1669.8031,13.3359, 19, -1);
    if(!dini_Exists(string))
    {
        gPlayerAccount[playerid] = 0;
         new regstring[256];
        new regname[64];
        SendClientMessage(playerid, COLOR_YELLOW, "Ти нямаш акаунт. Моля, регистрирай твоя акаунт.");
        GetPlayerName(playerid,regname,sizeof(regname));
        format(regstring,sizeof(regstring),"{FFFFFF}[ B-U-L-G-A-R-I-A-N ]{80FF00}[ S-E-R-V-E-R]{FF0000}[0.3]\n{80FF00}Моля регистрирай твоя акаунт преди да се логнеш");
        ShowPlayerDialog(playerid,12345,DIALOG_STYLE_PASSWORD,"Регистрация:",regstring,"Регистрирай","Излез");
        return 1;
    }
    else
    {
        gPlayerAccount[playerid] = 1;
        new loginstring[256];
        new loginname[64];
        SendClientMessage(playerid, COLOR_YELLOW, "SERVER: Това име е регистрирано.");
        SendClientMessage(playerid, COLOR_WHITE, "HINT: Ти може да се логнеш като си въведеш паролата");
        GetPlayerName(playerid,loginname,sizeof(loginname));
        format(loginstring,sizeof(loginstring),"{FFFFFF}server{80FF00}server{FF0000}[0.3]\n{80FF00}Името е регистрирано. Моля, въведи твоята парола");
        ShowPlayerDialog(playerid,12346,DIALOG_STYLE_PASSWORD,"Влизане:",loginstring,"Влез","Излез");
        return 1;
    }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You MUST agree to the server rules to play here.");
            Kick(playerid);
        }
}
        return 1;
    }
 
    return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)