/buy gun
#1

hi everyone.

i have problem with this script
can someone help me
i try to compile it but got this error

Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_RED 0xAA3333AA
#define DIALOGWEAPONS 100
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
        print("GunShop READY");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

IsAtAmmuplayer(playerid)
{
        if(IsPlayerConnected(playerid))
        {
                if(IsPlayerInRangeOfPoint(playerid, 60.0, 286.40,-40.49,1001.52))
                {
                    return 1;
                }
                else if(IsPlayerInRangeOfPoint(playerid, 60.0, 316.53,-169.42,999.60))
                {
                    return 1;
                }
                else if(IsPlayerInRangeOfPoint(playerid, 60.0, 285.53,-84.69,1001.52))
                {
                    return 1;
                }
                else if(IsPlayerInRangeOfPoint(playerid, 60.0, 296.96,-111.24,1001.52))
                {
                    return 1;
                }
                else if(IsPlayerInRangeOfPoint(playerid, 60.0, 315.80,-142.78,999.60))
                {
                    return 1;
                }
        }
        return 0;
}
CMD:buyguns(playerid, params[])
{
    if(!IsAtAmmuplayer(playerid))
        {
        SendClientMessage(playerid, COLOR_GRAD2, "INFO: You are not in a Ammunation Shop");
        return 1;
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOGWEAPONS, DIALOG_STYLE_LIST, "Ammunation Shop", "Grenade (2000$)\nArmour (2000$)\nDeagle (3000$)\nAk47 (5000$)\nM4 (6000$)\nCombat Shotgun (10000$)\nSniper Rifle (12000$)", "Buy", "Cancel");
    }
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   if(dialogid == DIALOGWEAPONS)
   {
       if(response)
	   {
      	    switch(listitem == 0)
   	        {
            case 0:
			{
			    if(GetPlayerMoney(playerid) <2000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
			    SendClientMessage(playerid, COLOR_RED, "You bought a Grenade.");
			    GivePlayerMoney(playerid, -2000);
                GivePlayerWeapon(playerid, 16, 1);
			}
            case 1:
			{
				if(GetPlayerMoney(playerid) <2000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");

				new Float:armour;
				GetPlayerArmour(playerid, armour);
				if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD4,"You already have a full vest!");
				SendClientMessage(playerid, COLOR_RED, "You bought a Kelvar.");
				GivePlayerMoney(playerid, -2000);
                SetPlayerArmour(playerid, 100);
			}
            case 2:
			{
				if(GetPlayerMoney(playerid) <3000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
				SendClientMessage(playerid, COLOR_RED, "You bought a Deagle.");
				GivePlayerMoney(playerid, -3000);
                GivePlayerWeapon(playerid, 24, 60000);
			}
            case 3:
			{
				if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
				SendClientMessage(playerid, COLOR_RED, "You bought a Ak47.");
				GivePlayerMoney(playerid, -5000);
                GivePlayerWeapon(playerid, 30, 60000);
			}
            case 4:
			{
				if(GetPlayerMoney(playerid) <6000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
				SendClientMessage(playerid, COLOR_RED, "You bought a M4.");
				GivePlayerMoney(playerid, -6000);
                GivePlayerWeapon(playerid, 31, 60000);
			}
            case 5:
			{
				if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
				SendClientMessage(playerid, COLOR_RED, "You bought a Combat Shotgun.");
				GivePlayerMoney(playerid, -10000);
                GivePlayerWeapon(playerid, 27, 60000);
			}
            case 6:
			{
			    if(GetPlayerMoney(playerid) <12000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
			    SendClientMessage(playerid, COLOR_RED, "You bought a Sniper Rifle.");
			    GivePlayerMoney(playerid, -12000);
                GivePlayerWeapon(playerid, 34, 60000);
            }
			}
			return 1;
 	 }
}

#endif
Error:
Код:
C:\Users\Sodjf\Desktop\llknlk.pwn(130) : error 030: compound statement not closed at the end of file (started at line 65)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
NOTE: i marked line 65
Reply
#2

Missing (closing) bracket. Indent your code, to make it more clear for yourself, and detect a problem. Error clearly says what the problem is.
Reply
#3

can you give me Guidance how to fix it sir ?
Reply
#4

Quote:
Originally Posted by NimaKhan
Посмотреть сообщение
can you give me Guidance how to fix it sir ?
No, I can't. If you don't understand what I mean, by making your code more clear, then there must be something wrong with you.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOGWEAPONS)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    if(GetPlayerMoney(playerid) <2000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
                    SendClientMessage(playerid, COLOR_RED, "You bought a Grenade.");
                    GivePlayerMoney(playerid, -2000);
                    GivePlayerWeapon(playerid, 16, 1);
                }
               
                case 1:
                {
                    if(GetPlayerMoney(playerid) <2000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
                    new Float:armour;
                    GetPlayerArmour(playerid, armour);
                    if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD4,"You already have a full vest!");
                    SendClientMessage(playerid, COLOR_RED, "You bought a Kelvar.");
                    GivePlayerMoney(playerid, -2000);
                    SetPlayerArmour(playerid, 100);
                }
               
                case 2:
                {
                    if(GetPlayerMoney(playerid) <3000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
                    SendClientMessage(playerid, COLOR_RED, "You bought a Deagle.");
                    GivePlayerMoney(playerid, -3000);
                    GivePlayerWeapon(playerid, 24, 60000);
                }
               
                case 3:
                {
                    if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
                    SendClientMessage(playerid, COLOR_RED, "You bought a Ak47.");
                    GivePlayerMoney(playerid, -5000);
                    GivePlayerWeapon(playerid, 30, 60000);
                }
               
                case 4:
                {
                    if(GetPlayerMoney(playerid) <6000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
                    SendClientMessage(playerid, COLOR_RED, "You bought a M4.");
                    GivePlayerMoney(playerid, -6000);
                    GivePlayerWeapon(playerid, 31, 60000);
                }
               
                case 5:
                {
                    if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
                    SendClientMessage(playerid, COLOR_RED, "You bought a Combat Shotgun.");
                    GivePlayerMoney(playerid, -10000);
                    GivePlayerWeapon(playerid, 27, 60000);
                }
               
                case 6:
                {
                    if(GetPlayerMoney(playerid) <12000) return SendClientMessage(playerid, COLOR_GRAD4, "You don't have enough money to buy this item!");
                    SendClientMessage(playerid, COLOR_RED, "You bought a Sniper Rifle.");
                    GivePlayerMoney(playerid, -12000);
                    GivePlayerWeapon(playerid, 34, 60000);
                }
            }
        }
        return 1;
    }
   
    return 1;
}
Sorry for being rude, but people are acting here like they've lost their brains and ability to read.
Reply
#5

Thanks man <3
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)