Soldier System
#1

Errors:
D:\SAMP Server\filterscripts\soldier.pwn(309) : warning 217: loose indentation
D:\SAMP Server\filterscripts\soldier.pwn(329) : warning 217: loose indentation

Код:
//////////Includes
#include <a_samp>
#include <zcmd>
/////////Defining
new Float:ap;
#define ARMOUR_INDEX 4
#define COLOR_RED 0xFF0000AA
#define LIGHTGREEN 0x00ff009e

/////////////////////////Loaded Script
main()
{
	print("\n----------------------------------");
	print("Soldier Equipement by Naruto_Emilio Loaded");
	print("----------------------------------\n");
}
/////////////////////When the filterscript is on exit mode

public OnFilterScriptExit()
{

        for(new i; i<MAX_PLAYERS; i++)
    {
        RemovePlayerAttachedObject(i,1);
        RemovePlayerAttachedObject(i,2);
        RemovePlayerAttachedObject(i,3);
        RemovePlayerAttachedObject(i,4);
    }
    ///////////////////////////////


        return 1;
}
//////////////if a player connects
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,COLOR_RED,"**Soldier Equipement System By: Naruto_Emilio**");
return 1;

}
//////////////////////////ZCMD COMMAND//////////////77
    CMD:soldier(playerid, params[])
    {
     ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "{FFFFFF}Armour Store", "{FFFFFF}Full Armour Pack{6EF83C}(10.000$)\n{FFFFFF}Armour{6EF83C}(4000$)\n{FFFFFF}Armour2{6EF83C}(10.000$)\nWeapons\n{FFFFFF}Extra Items", "{6EF83C}Purchase", "{FF0000}Cancel");

     return 1;
    }
    CMD:credits(playerid, params[])
    {
    SendClientMessage(playerid, COLOR_RED, "Armour System by Naruto_Emilio");
    SendClientMessage(playerid, COLOR_RED, "ZCMD Creator");
    SendClientMessage(playerid, COLOR_RED, "The dude that made the basic Tutorial");
    return 1;
    }
    CMD:whatsnew(playerid, params[])
    {
    SendClientMessage(playerid, LIGHTGREEN, "Version 1.5");
    SendClientMessage(playerid, COLOR_RED, "1-Money Bugs {FFFFFF}Fixed");
    SendClientMessage(playerid, COLOR_RED, "2-0.3c {FFFFFF}Colours");
    SendClientMessage(playerid, COLOR_RED, "3-New Armour Attached {FFFFFF}Object");
    SendClientMessage(playerid, COLOR_RED, "4-Weapons {FFFFFF}System");
    SendClientMessage(playerid, COLOR_RED, "More {FFFFFF}Updates {6EF83C}Soon");
    return 1;
    }



//////////////////////////////////////////////////////////////////////////////////////////////////////////////7

///////////////PLAYER UPDATES/////////////////
public OnPlayerUpdate(playerid)
{
    GetPlayerArmour(playerid,ap);
    if(ap<1)
    {
        RemovePlayerAttachedObject(playerid,1);
    }
///////////////////////////////////////////////

//////////////////////////////NEW ARMOUR

    return 1;
}
/////////////////////////////////dialog Reponse////////////////////////
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
    {
    switch(dialogid)
        {
        case 1:
    	    {
           	switch(listitem)
        	{
        	    case 0:
        	    {
        	        if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -10000);
                    SetPlayerAttachedObject(playerid,1,19142,1,0.1,0.05,0.0,0.0,0.0,0.0);//Armour
                    SetPlayerAttachedObject(playerid,2,19141,2,0.11,0.0,0.0,0.0,0.0,0.0);//Cask
                    SetPlayerAttachedObject(playerid,3,18637,13,0.35,0.0,0.0,0.0,0.0,180.0);//Shield
                    SetPlayerAttachedObject(playerid,4,18642,7,0.1,0.0,-0.11,0.0,-90.0,90.0);//tazer
                    SetPlayerArmour(playerid,100.0);
        	    }
        	    case 1:
        	    {
        	        if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -4000);
        	        SetPlayerArmour(playerid,50.0);
        	        SetPlayerAttachedObject(playerid,2,19141,2,0.11,0.0,0.0,0.0,0.0,0.0);//Cask
	        	    }
	            case 2:
        	    {
					if(GetPlayerMoney(playerid)< 10000) return SendClientMessage(playerid, 0xFFFFFF, "You don't Have Enough Money");
					GivePlayerMoney(playerid, -10000);
					SetPlayerArmour(playerid, 100.0);
					SetPlayerAttachedObject( playerid, ARMOUR_INDEX, 1242, 1, 0.019999, 0.039999, 0.000000, 2.459999, 89.699989, -3.100000, 1.710000, 2.119999, 1.719999);


        	    }
	            case 3:
	        {
                ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose Your Weapon", "{FF0000}Colt.45{6EF83C}($1000)\n{FF0000}Colt.45 Silenced{6EF83C}($1000)\n{FF0000}Desert Eagle{6EF83C}($1000)\n{FF0000}Mac 10{6EF83C}($2500)\n{FF0000}Tech 9{6EF83C}($2500)\n{FF0000}MP5{6EF83C}($5000)\n{FF0000}Sawn Off's{6EF83C}($5000)\n{FF0000}Combat Shotgun {6EF83C}($5000)\n{FF0000}AK-47 {6EF83C}($7500)\n{FF0000}M4 {6EF83C}($10000)\n{FF0000}Rifle {6EF83C}($7500)\n{FF0000}Sniper{6EF83C}($10000)", "Purchase", "Cancel");
           }
            case 4:
	        {
                ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Choose Your Item", "{FF0000}Refill Health{6EF83C}($1000)", "Purchase", "Cancel");
           }
	     }
	   }
	 }
   }

if(dialogid == 2 && response)
{
	switch(listitem)
	    {
	        case 0://colt.45f
	        {
	            if(GetPlayerMoney(playerid) >=1000)//change price here...
	            {
	                GivePlayerMoney(playerid, -1000);//and here
		            GivePlayerWeapon(playerid,22,500);
		            SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);

		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	        case 1://colt.45 silenced
	        {
	            if(GetPlayerMoney(playerid) >=1000)//change price here...
	            {
	                GivePlayerMoney(playerid, -1000);//and here
		            GivePlayerWeapon(playerid,23,500);
		            SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	        case 2://desert eagle
	        {
	            if(GetPlayerMoney(playerid) >=1000)//change price here...
	            {
	                GivePlayerMoney(playerid, -1000);//and here
		            GivePlayerWeapon(playerid,24,500);
                    SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
	                SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	        case 3://mac 10
	        {
	            if(GetPlayerMoney(playerid) >=2500)//change price here...
	            {
	                GivePlayerMoney(playerid, -2500);//and here
		            GivePlayerWeapon(playerid,28,500);
                    SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	        case 4://tech 9
	        {
	            if(GetPlayerMoney(playerid) >=2500)// i think you get the picture of how to change the prices now xD have fun :D.
	            {
	            	GivePlayerMoney(playerid, -2500);
		            GivePlayerWeapon(playerid,32,500);
		            SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	        case 5://mp5
	        {
	            if(GetPlayerMoney(playerid) >=5000)
	            {
	                GivePlayerMoney(playerid, -5000);
		            GivePlayerWeapon(playerid,29,500);
                    SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	        case 6://sawnoffs
	        {
	            if(GetPlayerMoney(playerid) >=5000)
	            {
	            	GivePlayerMoney(playerid, -5000);
		            GivePlayerWeapon(playerid,26,500);
		            SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	        case 7://combat shotgun
	        {
	            if(GetPlayerMoney(playerid) >=5000)
	            {
	                GivePlayerMoney(playerid, -5000);
		            GivePlayerWeapon(playerid,27,500);
                    SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	        case 8://AK-47
	        {
	            if(GetPlayerMoney(playerid) >=7500)
	            {
	                GivePlayerMoney(playerid, -7500);
		            GivePlayerWeapon(playerid,30,500);
		            SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't have Enought Money");
	            }
	        }
	        case 9://m4
	        {
	            if(GetPlayerMoney(playerid) >=10000)
	            {
	                GivePlayerMoney(playerid, -10000);
		            GivePlayerWeapon(playerid,31,500);
		            SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	        case 10://rifle
	        {
	            if(GetPlayerMoney(playerid) >=75000)
	            {
	                GivePlayerMoney(playerid, -75000);
		            GivePlayerWeapon(playerid,33,500);
		            SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	        case 11://sniper
	        {
	            if(GetPlayerMoney(playerid) >=10000)
	            {
	                GivePlayerMoney(playerid, -10000);
		            GivePlayerWeapon(playerid,34,500);
		            SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money Sniper");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You don't Have Enough Money");
	            }
	        }
	    }
	}
	if(dialogid == 4 && response)
	{
	    switch(listitem)
	    {
           case 0://health
	        {
	            if(GetPlayerMoney(playerid) >=1500)
	            {
	                GivePlayerMoney(playerid,-1500);
		            SetPlayerHealth(playerid,100.0);
		            SetPlayerChatBubble(playerid, "This player has bought items", COLOR_RED, 100.0, 1000000);
		            SendClientMessage(playerid,LIGHTGREEN,"You've Bought This Item!");
	            }
	            else
	            {
	                SendClientMessage(playerid,LIGHTGREEN,"You Don't Have Enough Money To Buy This");
	            }
	            }
	            }
	        }
return 1;
} 	    ////////////////////////////////////////////////////////
Reply
#2

Go to line 309 and press backspace.

So line 309 is: if(dialogid == 4 && response)

Place your marker behind the if, and press backspace.
Reply
#3

Thanks!
Reply
#4

Код:
warning 217: loose indentation
You can remove all warning 217 messages (loose indentation) by adding:
pawn Код:
#pragma tabsize 0
at very top of your script (below includes)

But it's not recommended.

Anyway, 'loose indentation' warning comes up when your lines in script aren't aligned.

Example:

// this will cause warning:

pawn Код:
public OnPlayerConnect(playerid)
{
    new
  pName[24];
 GetPlayerName(playerid, pName, 24);
        new string[11+MAX_PLAYER_NAME];
    format(string, sizeof(string), " Welcome %s..", pName);
  SendClientMessage(playerid, -1, string);
     return true;
}
// FIX:

pawn Код:
public OnPlayerConnect(playerid)
{
   new pName[24];
   GetPlayerName(playerid, pName, 24);
   new string[11+MAX_PLAYER_NAME];
   format(string, sizeof(string), " Welcome %s..", pName);
   SendClientMessage(playerid, -1, string);
   return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)