Crashs with class system
#1

why players have crashs with class system when is player killed sometimes he is crashed because problem is class system?? help what is problem
Code:
#define DIALOG_CLASS 0
Code:
public OnPlayerSpawn(playerid)
{

	                ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n(300 score required)\n(500 score required)\n(1000 score required)","Choose","");

		return 1;
        
}

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(dialogid == DIALOG_CLASS)
        {
            if(!response) return ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n(300 score required)\n(500 score required)\n(1000 score required)","Choose","");
            if(response)
            {
                switch(listitem)
                        {
                                case 0:
                                {
                                    GivePlayerWeapon(playerid,24,100);
                                    GivePlayerWeapon(playerid,16,1);
                                    GivePlayerWeapon(playerid,27,100);
                                    GivePlayerWeapon(playerid,31,80);
                                }
                                case 1:
                                {
                                    if(GetPlayerScore(playerid) < 100) return SendClientMessage(playerid,0xFF0000,"You must have at least 100 score to play in this class!"),ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n(300 score required)\n(500 score required)\n(1000 score required)","Choose","");
                                    GivePlayerWeapon(playerid,34,50);
                                    GivePlayerWeapon(playerid,4,1);
                                    GivePlayerWeapon(playerid,23,100);
                                    GivePlayerWeapon(playerid,46,1);

                                }
                                case 2:
                                {
                                    if(GetPlayerScore(playerid) < 300) return SendClientMessage(playerid,0xFF0000,"You must have at least 300 score to play in this class!"),ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n(300 score required)\n(500 score required)\n(1000 score required)","Choose","");
                                    GivePlayerWeapon(playerid,24,100);
                                    GivePlayerWeapon(playerid,25,60);
                                    GivePlayerWeapon(playerid,32,150);
                                    GivePlayerWeapon(playerid,16,1);


                                }
                                case 3:
                                {
                if(GetPlayerScore(playerid) < 500) return SendClientMessage(playerid,0xFF0000,"You must have at least 300 score to play in this class!"),ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n(300 score required)\n(500 score required)\n(1000 score required)","Choose","");
                                    GivePlayerWeapon(playerid,37,300);
                                    GivePlayerWeapon(playerid,18,5);
                                    GivePlayerWeapon(playerid,24,20);
                                    GivePlayerWeapon(playerid,4,1);
                                    GivePlayerWeapon(playerid,25,100);
                                }
                                case 4:
                                {
                                    if(GetPlayerScore(playerid) < 1000) return SendClientMessage(playerid,0xFF0000,"You must have at least 1000 score to play in this class!"),ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n\n(500 score required)\n(1000 score required)","Choose","");
                                    GivePlayerWeapon(playerid,26,150);
                                    GivePlayerWeapon(playerid,24,100);
                                    GivePlayerWeapon(playerid,16,2);
                                    GivePlayerWeapon(playerid,31,150);

                                }
                        }
                }
        }
        return 0;
}
Reply
#2

I think you have missed a listitem in your dialog. And you cant have a blank listitem in your dialog. Dont use "\n" in the begining.
pawn Code:
ShowPlayerDialog(playerid, _, _, _, "item1\n...", _, _);
"_" means your default values for the param. You have 5 cases in callback but 4 items in dialog.

Also, in dialog response callback, try to use indentation rather using "," for 1 statement after another.
And dont return 0 in it.

I dont see anything else causing problem from the provided code.
Reply
#3

maybe this is help your problem

PHP Code:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
        if(
dialogid == DIALOG_CLASS)
        {
            if(!
response) return ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n(300 score required)\n(500 score required)\n(1000 score required)","Choose","");
            if(
response)
            {
                switch(
listitem)
                        {
                                case 
0:
                                {
                                    
GivePlayerWeapon(playerid,24,100);
                                    
GivePlayerWeapon(playerid,16,1);
                                    
GivePlayerWeapon(playerid,27,100);
                                    
GivePlayerWeapon(playerid,31,80);
                                }
                                case 
1:
                                {
                                    if(
GetPlayerScore(playerid) < 100) return SendClientMessage(playerid,0xFF0000,"You must have at least 100 score to play in this class!"),ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n(300 score required)\n(500 score required)\n(1000 score required)","Choose","");
                                    
GivePlayerWeapon(playerid,34,50);
                                    
GivePlayerWeapon(playerid,4,1);
                                    
GivePlayerWeapon(playerid,23,100);
                                    
GivePlayerWeapon(playerid,46,1);

                                }
                                case 
2:
                                {
                                    if(
GetPlayerScore(playerid) < 300) return SendClientMessage(playerid,0xFF0000,"You must have at least 300 score to play in this class!"),ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n(300 score required)\n(500 score required)\n(1000 score required)","Choose","");
                                    
GivePlayerWeapon(playerid,24,100);
                                    
GivePlayerWeapon(playerid,25,60);
                                    
GivePlayerWeapon(playerid,32,150);
                                    
GivePlayerWeapon(playerid,16,1);


                                }
                                case 
3:
                                {
                if(
GetPlayerScore(playerid) < 500) return SendClientMessage(playerid,0xFF0000,"You must have at least 300 score to play in this class!"),ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n(300 score required)\n(500 score required)\n(1000 score required)","Choose","");
                                    
GivePlayerWeapon(playerid,37,300);
                                    
GivePlayerWeapon(playerid,18,5);
                                    
GivePlayerWeapon(playerid,24,20);
                                    
GivePlayerWeapon(playerid,4,1);
                                    
GivePlayerWeapon(playerid,25,100);
                                }
                                case 
4:
                                {
                                    if(
GetPlayerScore(playerid) < 1000) return SendClientMessage(playerid,0xFF0000,"You must have at least 1000 score to play in this class!"),ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","\n(100 score required)\n\n(500 score required)\n(1000 score required)","Choose","");
                                    
GivePlayerWeapon(playerid,26,150);
                                    
GivePlayerWeapon(playerid,24,100);
                                    
GivePlayerWeapon(playerid,16,2);
                                    
GivePlayerWeapon(playerid,31,150);

                                }
                        }
                }
        }
        return 
1;

Reply
#4

no again same problem
Reply
#5

Try this:
pawn Code:
public OnPlayerSpawn(playerid)
{

                    ShowPlayerDialog(playerid,DIALOG_CLASS,DIALOG_STYLE_LIST,"Class selection:","(100 score required)\n(300 score required)\n(500 score required)\n(1000 score required)","Choose","");

        return 1;
       
}
Reply
#6

He said sometimes, which leads me to believe this has nothing to do with the dialog system. Not sure what your actual problem is, but I doubt it's that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)