Help with brackets
#1

Here is a piece of my code:
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   	if (newkeys & KEY_SUBMISSION)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == TOWTRUCK)
		{
		    new Float:aCoo[3];
			for(new v=0;v<MAX_VEHICLES;v++)
			{
			    if(!vehicleDB[v][locked])
			    {
			        if(vehicleid != v)
			        {
						GetVehiclePos(v,aCoo[0],aCoo[1],aCoo[2]);
						if(PlayerToPoint(10,playerid,aCoo[0],aCoo[1],aCoo[2]) && !IsTurgus(aCoo[0],aCoo[1]))
						{
							AttachTrailerToVehicle(v,GetPlayerVehicleID(playerid));
							return 1;
						}
					}
				}
	        }
		}
 		return 1;
 		
	}else if (newkeys & KEY_SECONDARY_ATTACK)
	{
		if(playerDB[playerid][pila])
		{
		    playerDB[playerid][pila]=false;
		    }
		if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER && IsPlayerInAnyVehicle(playerid))
	    {
	        new vehicleid = GetPlayerVehicleID(playerid);
			if(vehicleDB[vehicleid][gas] < 1)
			{
			   	GetVehiclePos(vehicleid,vehicleDB[vehicleid][lastpos][0],vehicleDB[vehicleid][lastpos][1],vehicleDB[vehicleid][lastpos][2]);
				GetVehicleZAngle(vehicleid,vehicleDB[vehicleid][lastpos][3]);
                TogglePlayerControllable(playerid,true);
				RemovePlayerFromVehicle(playerid);
				return 1;
				}
			}
	    if(playerDB[playerid][lektuvas]!=-1)
	    {
	        new Float:bbX, Float:bbY, Float:bbZ, Float:bbA;
	 		GetVehiclePos(playerDB[playerid][lektuvas], bbX, bbY, bbZ);
  			GetVehicleZAngle(playerDB[playerid][lektuvas], bbA);
  			bbX += (5 * floatsin(-floatsub(bbA, 45.0), degrees)),
  			bbY += (5 * floatcos(-floatsub(bbA, 45.0), degrees));
  			SetPlayerInterior(playerid, 0);
  			SetPlayerPos(playerid, bbX, bbY, floatsub(bbZ, 0.94));
			SetPlayerFacingAngle(playerid, bbA);
			SetPlayerVirtualWorld(playerid,0);
			playerDB[playerid][lektuvas]=-1;
			return 1;
			}
		}
When i compile my gamemode i get 26 errors that are non-sense.
Using Missing Brackets Finder i found that there is 1 missing } . (or maybe too much { )
I tryed to fix this bracket thing my self but when i compile Pawno stops responding (Pawno Library is Not Responding window). Can someone please help me to fix this?


P.S. the language of this code is not english as you can see, and all unfamiliar words are explained to Pawno.
Reply
#2

Maybe that part is fine and the missing bracket is somewhere else. You should check it.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & KEY_SUBMISSION)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == TOWTRUCK)
        {
            new Float:aCoo[3];
            for(new v=0;v<MAX_VEHICLES;v++)
            {
                if(!vehicleDB[v][locked])
                {
                    if(vehicleid != v)
                    {
                        GetVehiclePos(v,aCoo[0],aCoo[1],aCoo[2]);
                        if(PlayerToPoint(10,playerid,aCoo[0],aCoo[1],aCoo[2]) && !IsTurgus(aCoo[0],aCoo[1]))
                        {
                            AttachTrailerToVehicle(v,GetPlayerVehicleID(playerid));
                            return 1;
                        }
                    }
                }
            }
        }
        return 1;

    }
    else if (newkeys & KEY_SECONDARY_ATTACK)
    {
        if(playerDB[playerid][pila])
        {
            playerDB[playerid][pila]=false;
        }
        if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER && IsPlayerInAnyVehicle(playerid))
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            if(vehicleDB[vehicleid][gas] < 1)
            {
                GetVehiclePos(vehicleid,vehicleDB[vehicleid][lastpos][0],vehicleDB[vehicleid][lastpos][1],vehicleDB[vehicleid][lastpos][2]);
                GetVehicleZAngle(vehicleid,vehicleDB[vehicleid][lastpos][3]);
                TogglePlayerControllable(playerid,true);
                RemovePlayerFromVehicle(playerid);
                return 1;
            }
        }
        if(playerDB[playerid][lektuvas]!=-1)
        {
            new Float:bbX, Float:bbY, Float:bbZ, Float:bbA;
            GetVehiclePos(playerDB[playerid][lektuvas], bbX, bbY, bbZ);
            GetVehicleZAngle(playerDB[playerid][lektuvas], bbA);
            bbX += (5 * floatsin(-floatsub(bbA, 45.0), degrees)),
            bbY += (5 * floatcos(-floatsub(bbA, 45.0), degrees));
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, bbX, bbY, floatsub(bbZ, 0.94));
            SetPlayerFacingAngle(playerid, bbA);
            SetPlayerVirtualWorld(playerid,0);
            playerDB[playerid][lektuvas]=-1;
            return 1;
        }
    }
    // Rest of code
    return 1;
}
Reply
#3

Nevermind then.
Reply
#4

The missing bracket finder said its here.
And what i must scroll all 21k lines counting brackets?? thats insane.
playbox12, what do you mean, you wanted to say something.
__________________________________________________ _________
Dwane, i tried using what you fixed and Pawno stopped responding.
I checked it with missing brackets finder now and it said that all brackets are equal.
Reply
#5

Thanks Suthclaw ! That Notepad++ is awesome!
But i still have this brace problem. (i think)
Well when compiling i get 26errors (undefined symbol), but those errors dont make any sense, cause in place of them everything is correct. i heard that it means problem with braces, right?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)