SA-MP Forums Archive
Buyguns menu - 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: Buyguns menu (/showthread.php?tid=462123)



Buyguns menu - lider1241 - 05.09.2013

I built a little buyguns command for ammunation menu, but when i compile it the pawn compiler crashes... (this on the GM pwn)
im using ZCMD

in the top of the script:

Код:
#define BUYGUNS 9754
Код:
if(dialogid == 9754)
	{
		if(response)
        {
			if(listitem == 0)
			{
				if(GetPlayerMoney(playerid) > 1000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}
				GivePlayerCash(playerid, -1000);
				GameTextForPlayer(playerid, "~r~ -1000$", 5000, 1);
				GivePlayerValidWeapon(playerid, 22, 60000);
			}
			if(listitem == 1)
			{
				if(GetPlayerMoney(playerid) > 5000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}
				GivePlayerCash(playerid, -5000);
				GameTextForPlayer(playerid, "~r~ -5000$", 5000, 1);
				GivePlayerValidWeapon(playerid, 25, 60000);
			}
			if(listitem == 2)
			{
			if(GetPlayerMoney(playerid) > 10000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}
			GivePlayerCash(playerid, -10000);
			GameTextForPlayer(playerid, "~r~ -10000$", 5000, 1);
			GivePlayerValidWeapon(playerid, 33, 60000);
			}
		}
		return 1;
	}

Код:
CMD:buyguns(playerid, params[])
{
        if(!IsPlayerInRangeOfPoint(playerid, 3.0, 308.2658, -140.7199, 999.6016))
{
        SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the Goverment Ammunation!");
        return 1;
{		
        ShowPlayerDialog(playerid,BUYGUNS,DIALOG_STYLE_LIST,"Legal Weapons","MM9 {80FF00}$1000{FFFFFF}\nShotgun {80FF00}$5000{FFFFFF}\nRifle {80FF00}$10000","Select", "Back");
        return 1;
}



Re: Buyguns menu - WopsS - 05.09.2013

pawn Код:
CMD:buyguns(playerid, params[])
{
        if(!IsPlayerInRangeOfPoint(playerid, 3.0, 308.2658, -140.7199, 999.6016))
        {
        SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the Goverment Ammunation!");
        return 1;
        } // Here was the problem!
        ShowPlayerDialog(playerid,BUYGUNS,DIALOG_STYLE_LIST,"Legal Weapons","MM9 {80FF00}$1000{FFFFFF}\nShotgun {80FF00}$5000{FFFFFF}\nRifle {80FF00}$10000","Select", "Back");
        return 1;
}
Try this.


Re: Buyguns menu - lider1241 - 05.09.2013

Still pawn compiler crashes....


Re: Buyguns menu - WopsS - 05.09.2013

Try.

Top of the script:
pawn Код:
#define DIALOG_BUYGUNS 9754
pawn Код:
if(dialogid == DIALOG_BUYGUNS)
    {
        if(response)
        {
            if(listitem == 0)
            {
                if(GetPlayerMoney(playerid) > 1000)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");
                    return 1;
                }
                GivePlayerCash(playerid, -1000);
                GameTextForPlayer(playerid, "~r~ -1000$", 5000, 1);
                GivePlayerValidWeapon(playerid, 22, 60000);
            }
            if(listitem == 1)
            {
                if(GetPlayerMoney(playerid) > 5000)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");
                    return 1;
                }
                GivePlayerCash(playerid, -5000);
                GameTextForPlayer(playerid, "~r~ -5000$", 5000, 1);
                GivePlayerValidWeapon(playerid, 25, 60000);
            }
            if(listitem == 2)
            {
                if(GetPlayerMoney(playerid) > 10000)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");
                    return 1;
                }
                GivePlayerCash(playerid, -10000);
                GameTextForPlayer(playerid, "~r~ -10000$", 5000, 1);
                GivePlayerValidWeapon(playerid, 33, 60000);
            }
        }
    }
pawn Код:
CMD:buyguns(playerid, params[])
{
        if(!IsPlayerInRangeOfPoint(playerid, 3.0, 308.2658, -140.7199, 999.6016))
        {
        SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the Goverment Ammunation!");
        return 1;
        }
     ShowPlayerDialog(playerid,BUYGUNS,DIALOG_STYLE_LIST,"Legal Weapons","MM9 {80FF00}$1000{FFFFFF}\nShotgun {80FF00}$5000{FFFFFF}\nRifle {80FF00}$10000","Select", "Back");
      return 1;
}
EDIT: try what he said (Konstantinos)


Re: Buyguns menu - Konstantinos - 05.09.2013

If the compiler still gets crashed, then you should check about missing brackets.
A useful tool for that is BracketFix by iPLEOMAX.


Re: Buyguns menu - IceBilizard - 05.09.2013

pawn Код:
#define BUYGUNS 9754

if(dialogid == 9754)
{
        if(response)
        {
            if(listitem == 0)
            {
                if(GetPlayerMoney(playerid) > 1000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}
                GivePlayerCash(playerid, -1000);
                GameTextForPlayer(playerid, "~r~ -1000$", 5000, 1);
                GivePlayerValidWeapon(playerid, 22, 60000);
            }
            if(listitem == 1)
            {
                if(GetPlayerMoney(playerid) > 5000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}
                GivePlayerCash(playerid, -5000);
                GameTextForPlayer(playerid, "~r~ -5000$", 5000, 1);
                GivePlayerValidWeapon(playerid, 25, 60000);
            }
            if(listitem == 2)
            {
            if(GetPlayerMoney(playerid) > 10000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}
            GivePlayerCash(playerid, -10000);
            GameTextForPlayer(playerid, "~r~ -10000$", 5000, 1);
            GivePlayerValidWeapon(playerid, 33, 60000);
            }
        }
        return 1;
}

CMD:buyguns(playerid, params[])
{
        if(!IsPlayerInRangeOfPoint(playerid, 3.0, 308.2658, -140.7199, 999.6016))
        {
        SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the Goverment Ammunation!");
        return 1;
        }
        else
        {
        ShowPlayerDialog(playerid,BUYGUNS,DIALOG_STYLE_LIST,"Legal Weapons","MM9 {80FF00}$1000{FFFFFF}\nShotgun {80FF00}$5000{FFFFFF}\nRifle {80FF00}$10000","Select", "Back");
        return 1;
        }
}
he did big mistake with his command

see here

pawn Код:
CMD:buyguns(playerid, params[])
{
        if(!IsPlayerInRangeOfPoint(playerid, 3.0, 308.2658, -140.7199, 999.6016))
        {
        SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the Goverment Ammunation!");
        return 1;
        }// You missed to close this bracket
        //here should be else
        else
        {      
        ShowPlayerDialog(playerid,BUYGUNS,DIALOG_STYLE_LIST,"Legal Weapons","MM9 {80FF00}$1000{FFFFFF}\nShotgun {80FF00}$5000{FFFFFF}\nRifle {80FF00}$10000","Select", "Back");
        return 1;
        }



Re: Buyguns menu - lider1241 - 05.09.2013

Still crashing -_-
and Konstantinos the bracketfix didnt identify any wrong brackets


Re: Buyguns menu - WopsS - 05.09.2013

Try this
pawn Код:
CMD:buyguns(playerid, params[])
{
        if(!IsPlayerInRangeOfPoint(playerid, 3.0, 308.2658, -140.7199, 999.6016))
        {
        SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the Goverment Ammunation!");
        return 1;
        }
        else
        {
            ShowPlayerDialog(playerid,BUYGUNS,DIALOG_STYLE_LIST,"Legal Weapons","MM9 {80FF00}$1000{FFFFFF}\nShotgun {80FF00}$5000{FFFFFF}\nRifle {80FF00}$10000","Select", "Back");
            return 1;
        }
}
@IceBilizard you forgot a "}"


Re: Buyguns menu - IceBilizard - 05.09.2013

dude see his dialog he giving brackets in last see

pawn Код:
#define BUYGUNS 9754

if(dialogid == 9754)
{
        if(response)
        {
            if(listitem == 0)
            {
                if(GetPlayerMoney(playerid) > 1000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");
                GivePlayerCash(playerid, -1000);
                GameTextForPlayer(playerid, "~r~ -1000$", 5000, 1);
                GivePlayerValidWeapon(playerid, 22, 60000);
            }
            if(listitem == 1)
            {
                if(GetPlayerMoney(playerid) > 5000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");
                GivePlayerCash(playerid, -5000);
                GameTextForPlayer(playerid, "~r~ -5000$", 5000, 1);
                GivePlayerValidWeapon(playerid, 25, 60000);
            }
            if(listitem == 2)
            {
            if(GetPlayerMoney(playerid) > 10000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");
            GivePlayerCash(playerid, -10000);
            GameTextForPlayer(playerid, "~r~ -10000$", 5000, 1);
            GivePlayerValidWeapon(playerid, 33, 60000);
            }
        }
        return 1;
}
dude see his dialog he giving brackets in last see

pawn Код:
#define BUYGUNS 9754

if(dialogid == 9754)
{
        if(response)
        {
            if(listitem == 0)
            {
                if(GetPlayerMoney(playerid) > 1000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}//Here
                GivePlayerCash(playerid, -1000);
                GameTextForPlayer(playerid, "~r~ -1000$", 5000, 1);
                GivePlayerValidWeapon(playerid, 22, 60000);
            }
            if(listitem == 1)
            {
                if(GetPlayerMoney(playerid) > 5000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}//Here
                GivePlayerCash(playerid, -5000);
                GameTextForPlayer(playerid, "~r~ -5000$", 5000, 1);
                GivePlayerValidWeapon(playerid, 25, 60000);
            }
            if(listitem == 2)
            {
            if(GetPlayerMoney(playerid) > 10000) return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much!");}//Here
            GivePlayerCash(playerid, -10000);
            GameTextForPlayer(playerid, "~r~ -10000$", 5000, 1);
            GivePlayerValidWeapon(playerid, 33, 60000);
            }
        }
        return 1;
}



Re: Buyguns menu - IceBilizard - 05.09.2013

Remove those brackets then see