SA-MP Forums Archive
lol, theres nothing happen OnDialogReponse - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: lol, theres nothing happen OnDialogReponse (/showthread.php?tid=511994)



lol, theres nothing happen OnDialogReponse - Trynda - 08.05.2014

Yo Bro's

Theres nothing happen with this actions

Код:
	if(dialogid == DIALOG_FAM_TOKEN)
	{
	    if(response)
	    {
	        switch(dialogid)
	        {
	            case 1:
	            {
	                switch(listitem)
	                {
	                    case 0:
	                    {
	                        if(FamilyInfo[playerid][FamilyTurfTokens] >= 3)
	                        {
	                            GivePlayerValidWeapon(playerid, 26, 999999999);
								SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have buy sawn-off shotgun for 3 tokens!");
								FamilyInfo[playerid][FamilyTurfTokens] -=3;
	                        }
	                        else return SendClientMessage(playerid, COLOR_GRAD1, "You dont have 3 token to buy that!");
	                    }
					}
				}
	        }
	    }
	}
Код:
CMD:ftokenshop(playerid, params[])
{
    //if(PlayerInfo[playerid][pGang] > 0)
    //{
		if(IsPlayerInRangeOfPoint(playerid, 2.0 ,-2235.1304, 130.1577, 1035.4141))
		{
		    ShowPlayerDialogEx(playerid, DIALOG_FAM_TOKEN, DIALOG_STYLE_LIST, "Philippines-Roleplay Family Token Shop", "Sawn-off shotgun(3 Token)\n Uzi(2 Token)\nSpas(4 Token)\n200 Armor(8 Token)\nRPG(Special 200 Token", "Select", "Cancel");
		} else return SendClientMessage(playerid, COLOR_WHITE, "Your not range in Family Token Shop!");
		return 1;
		
    //}
    //return SendClientMessage(playerid, COLOR_REALRED, "Your not in any gang!!!!!!!!!!");
}



Re: lol, theres nothing happen OnDialogReponse - AndySedeyn - 08.05.2014

Make sure that public OnDialogResponse returns 0.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 0;
}



Re: lol, theres nothing happen OnDialogReponse - Trynda - 08.05.2014

Quote:
Originally Posted by Bible
Посмотреть сообщение
Make sure that public OnDialogResponse returns 0.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 0;
}
YEP! Unter OnDialogResponse


Re: lol, theres nothing happen OnDialogReponse - AndySedeyn - 08.05.2014

Maybe this could help:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_FAM_TOKEN)
    {
        if(response)
        {
            switch(dialogid)
            {
                case 1:
                {
                    switch(listitem)
                    {
                        case 0:
                        {
                            if(FamilyInfo[playerid][FamilyTurfTokens] >= 3)
                            {
                                GivePlayerValidWeapon(playerid, 26, 999999999);
                                SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have buy sawn-off shotgun for 3 tokens!");
                                FamilyInfo[playerid][FamilyTurfTokens] -=3;
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GRAD1, "You dont have 3 token to buy that!");
                            }
                        }
                    }
                }
            }
        }
    }
    return 0;
}
CMD:ftokenshop(playerid, params[])
{
    //if(PlayerInfo[playerid][pGang] > 0)
    //{
        if(IsPlayerInRangeOfPoint(playerid, 2.0 ,-2235.1304, 130.1577, 1035.4141))
        {
            ShowPlayerDialogEx(playerid, DIALOG_FAM_TOKEN, DIALOG_STYLE_LIST, "Philippines-Roleplay Family Token Shop", "Sawn-off shotgun(3 Token)\n Uzi(2 Token)\nSpas(4 Token)\n200 Armor(8 Token)\nRPG(Special 200 Token", "Select", "Cancel");
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "Your not range in Family Token Shop!");
        }
        return 1;

    //}
    //return SendClientMessage(playerid, COLOR_REALRED, "Your not in any gang!!!!!!!!!!");
}



Re: lol, theres nothing happen OnDialogReponse - Konstantinos - 08.05.2014

Check the dialogid either with switch (recommended) or with if/else if statement. It's kind of pointless to check if the dialog is equal to DIALOG_FAM_TOKEN and theck checking again if the dialogid is 1.

All your scripts that use OnDialogResponse callback must return 0 at the end of it.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch (dialogid)
    {
        case DIALOG_FAM_TOKEN:
        {
            if (response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        if (FamilyInfo[playerid][FamilyTurfTokens] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "You dont have 3 token to buy that!");
                        GivePlayerValidWeapon(playerid, 26, 999999999);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have buy sawn-off shotgun for 3 tokens!");
                        FamilyInfo[playerid][FamilyTurfTokens] -=3;
                    }
                }
            }
        }
    }
    return 0;
}



Re: lol, theres nothing happen OnDialogReponse - Trynda - 08.05.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Check the dialogid either with switch (recommended) or with if/else if statement. It's kind of pointless to check if the dialog is equal to DIALOG_FAM_TOKEN and theck checking again if the dialogid is 1.

All your scripts that use OnDialogResponse callback must return 0 at the end of it.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch (dialogid)
    {
        case DIALOG_FAM_TOKEN:
        {
            if (response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        if (FamilyInfo[playerid][FamilyTurfTokens] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "You dont have 3 token to buy that!");
                        GivePlayerValidWeapon(playerid, 26, 999999999);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have buy sawn-off shotgun for 3 tokens!");
                        FamilyInfo[playerid][FamilyTurfTokens] -=3;
                    }
                }
            }
        }
    }
    return 0;
}
THANKS BRO YOUR THE PRO! YOU SHOULD BE ON BETA TESTER RIGHT NOW!!!!!!!!!!!!!!!!!!!!!!!!!!