Choose rank problem
#1

I have a choose rank dialog,but it wont work when I click it.Here is the code :
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == dialreg)
    {
        if(!
response) return Kick(playerid);
        if(
response)
        {
            if(!
strlen(inputtext))
            {
             
ShowPlayerDialog(playerid,dialreg,DIALOG_STYLE_PASSWORD,"Register","{FFFFFF}Welcome,\n\nThis account isn't {33CC33}registered !\n\n{FFFFFF}Enter your own {33CC33}password {FFFFFF}to create a new {33CC33}account !","Register","Quit");
            }
            new 
hashpass[129]; 
            
WP_Hash(hashpass,sizeof(hashpass),inputtext);
            new 
INI:file INI_Open(Path(playerid)); 
            
INI_SetTag(file,"Player's Data");
            
INI_WriteString(file,"Password",hashpass);
            
INI_WriteInt(file,"Admin Level",0);
            
INI_WriteInt(file,"Ranks",0);
            
INI_WriteInt(file,"Money",0);
            
INI_WriteInt(file,"Scores",0);
            
INI_WriteInt(file,"Kills",0);
            
INI_WriteInt(file,"Deaths",0);
            
INI_WriteInt(file,"Warns",0);
            
INI_Close(file);
            
ShowPlayerDialog(playerid,dialsuccess1,DIALOG_STYLE_MSGBOX,"Register","{33CC33}Congratulation,\n\n{FFFFFF}You have been successfully {33CC33}registered {FFFFFF}!","Okay","");
            return 
1;
        }
    }
    if(
dialogid == diallogin)
    {
        if(!
response) return Kick(playerid);
        if(
response
        {
            new 
hashpass[129]; 
            
WP_Hash(hashpass,sizeof(hashpass),inputtext); 
            if(!
strcmp(hashpasspInfo[playerid][Pass], false))
            {
                
INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra true, .extra playerid);
                
SetPlayerScore(playerid,pInfo[playerid][Scores]);
                
GivePlayerMoney(playerid,pInfo[playerid][Money]);
                
ShowPlayerDialog(playerid,dialsuccess2,DIALOG_STYLE_MSGBOX,"Register","{33CC33}Congratulation,\n\n{FFFFFF}You have been successfully {33CC33}login {FFFFFF}!","Okay","");
            }
            else 
            {
                
ShowPlayerDialog(playerid,diallogin,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Sorry,\n\n{FF0000}Incorrect password {FFFFFF}!\n\n{FFFFFF}Please enter your {33CC33}password {FFFFFF}below !","Login","Quit");
            }
    }
    if(
dialogid == DIALOG_RANK)//loose indentation
    
{
        if(!
response) return ShowPlayerDialog(playerid,DIALOG_RANK,DIALOG_STYLE_LIST,"Choose your rank","{FF80FF}Leader {FFFFFF}~ Rank 3\n{33CC33}CO-Leader {FFFFFF}~ Rank 2\n{FF0000}Elder {FFFFFF}~ Rank 1\n{33CC33}Guest {FFFFFF}~ Rank 0","Choose","");
        if(
response)
        {
            if(
listitem == 0//LEADER = Police
            
{
                
AddPlayerClass(137,1574.9681,-1635.9956,13.5509,87.9275,0,0,0,0,0,0); // LSPD
                
SendClientMessage(playerid0xFFFFFFAA"** Welcome {33CC33}SoD Leader {FFFFFF}**");
            }
            if(
listitem == 1)//CO-Leader = Biker
            
{
                
AddPlayerClass(230,2317.3718,-1650.7227,14.2248,186.4385,0,0,0,0,0,0); // Biker
                
SendClientMessage(playerid0xFFFFFFAA"** Welcome {33CC33}SoD CO-Leader {FFFFFF}**");
            }
            if(
listitem == 2)//Elder = Grove Street
            
{
                
AddPlayerClass(134,2511.5886,-1665.9419,13.5726,93.2240,0,0,0,0,0,0); // Groove St
                
SendClientMessage(playerid0xFFFFFFAA"** Welcome {33CC33}SoD Elder {FFFFFF}**");
            }
            if(
listitem == 3)//Guest = Grove Street
            
{
                
AddPlayerClass(111,2511.5886,-1665.9419,13.5726,93.2240,0,0,0,0,0,0); // Groove St
                
SendClientMessage(playerid0xFFFFFFAA"** Welcome {33CC33}Guest {FFFFFF}**");
                
SendClientMessage(playerid0xFFFFFFAA"** Enjoy your stay here **");
            }
         }
      }
    }
    return 
1;

and there is a loose indentation problem.I tried to fix it but it won't work at all.I like to make my scripts free any warning/error
Reply
#2

I can't understand whats wrong? I will fix your indentation problem but, whats the real problem?
Reply
#3

AS you can see,there is
PHP код:
if(dialogid == DIALOG_RANK)//loose indentation
    
{
        if(!
response) return ShowPlayerDialog(playerid,DIALOG_RANK,DIALOG_STYLE_LIST,"Choose your rank","{FF80FF}Leader {FFFFFF}~ Rank 3\n{33CC33}CO-Leader {FFFFFF}~ Rank 2\n{FF0000}Elder {FFFFFF}~ Rank 1\n{33CC33}Guest {FFFFFF}~ Rank 0","Choose","");
        if(
response)
        {
            if(
listitem == 0//LEADER = Police
            
{
                
AddPlayerClass(137,1574.9681,-1635.9956,13.5509,87.9275,0,0,0,0,0,0); // LSPD
                
SendClientMessage(playerid0xFFFFFFAA"** Welcome {33CC33}SoD Leader {FFFFFF}**");

            }
            if(
listitem == 1)//CO-Leader = Biker
            
{
                
AddPlayerClass(230,2317.3718,-1650.7227,14.2248,186.4385,0,0,0,0,0,0); // Biker
                
SendClientMessage(playerid0xFFFFFFAA"** Welcome {33CC33}SoD CO-Leader {FFFFFF}**");

            }
            if(
listitem == 2)//Elder = Grove Street
            
{
                
AddPlayerClass(134,2511.5886,-1665.9419,13.5726,93.2240,0,0,0,0,0,0); // Groove St
                
SendClientMessage(playerid0xFFFFFFAA"** Welcome {33CC33}SoD Elder {FFFFFF}**");
            }
            if(
listitem == 3)//Guest = Grove Street
            
{
                
AddPlayerClass(111,2511.5886,-1665.9419,13.5726,93.2240,0,0,0,0,0,0); // Groove St
                
SendClientMessage(playerid0xFFFFFFAA"** Welcome {33CC33}Guest {FFFFFF}**");
                
SendClientMessage(playerid0xFFFFFFAA"** Enjoy your stay here **");
            } 
My problem is this code doesn't work.When I press any item list InGame there's nothing happen.
Reply
#4

I am not quite sure what is the result you are expecting, but what you do is to add classes to the class selection. You could use SetSpawnInfo, SetPlayerSkin and SpawnPlayer functions as it would be more efficient.
Reply
#5

I don't want to do that.Sometime AddPlayerClass won't work for me.And I need to set the camera post and etc.
Reply
#6

At least does it send the messages for the picked list item ?
Reply
#7

Nope
Reply
#8

Have you checked for dialog ID conflicts ?
Reply
#9

Naah nah, try checking your gamemode's OnDialogResponse callback, check the last return if its 1 thats what caused it.
If not, try unloading all filterscripts and try it.
Reply
#10

This script is from my GM and I have define the dialog ID on top so there is no conflict on it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)