What am i doing wrong?
#1

Just trying to make a command for opening the trunk where i can do /boot and the trunk opens and when i do /boot again it closes then again it opens again and so on. but i have getting errors and i cant firgure it out.
Код:
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : error 017: undefined symbol "TrunkOpen"
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : warning 215: expression has no effect
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : error 001: expected token: ";", but found "]"
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : fatal error 107: too many error messages on one line
pawn Код:
CMD:boot( playerid, params[] )
{
    if( !IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, -1, "Error: You need to be in a vehicle." );
    {
        if(TrunkOpen[playerid] == true);//this line is 5
        {
            TrunkOpen[playerid] = false;
            new pVeh;
            new engine,lights,alarm,doors,bonnet,boot,objective;
            pVeh = GetPlayerVehicleID( playerid );
            GetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, 0, objective);
            SendClientMessage(playerid, -1, "Trunk Closed");
        }
        else
        {
            TrunkOpen[playerid] = true;
            new pVeh;
            new engine,lights,alarm,doors,bonnet,boot,objective;
            pVeh = GetPlayerVehicleID( playerid );
            GetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, 1, objective);
            SendClientMessage(playerid, -1, "Trunk Open");
        }
    }
    return 1;
}
I know i prolly did something simple but i cant get it fixed.

Thanks
Reply
#2

pawn Код:
// place it at top of you're script.
new TrunkOpen[MAX_PLAYERS];
Reply
#3

Quote:
Originally Posted by Kitten
Посмотреть сообщение
pawn Код:
// place it at top of you're script.
new TrunkOpen[MAX_PLAYERS];
I had that under OnGameModeInt() but i moved it under a_samp now and i get these

Код:
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : error 017: undefined symbol "TrunkOpen"
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(5) : error 036: empty statement
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(7) : error 017: undefined symbol "TrunkOpen"
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(15) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PlayerCommands.inc(17) : error 017: undefined symbol "TrunkOpen"
Am i supposed to change TrunkOpen[playerid] in the command to TrunkOpen[MAX_PLAYERS] too?
Reply
#4

No you do not need to add MAX_PLAYERS in TruckOpen in the command,

MAX_PLAYERS is getting the players amount out of the server slot (500), i can see you're using an include, mind sending the lines?
Reply
#5

Quote:
Originally Posted by Kitten
Посмотреть сообщение
No you do not need to add MAX_PLAYERS in TruckOpen in the command,

MAX_PLAYERS is getting the players amount out of the server slot (500), i can see you're using an include, mind sending the lines?
Its just a include with all my commands. Its the same as it was in the first post.
Reply
#6

Bump
Any suggestions?
Reply
#7

pawn Код:
new bool:TrunkOpen[MAX_PLAYERS];
the first poster above was correct but it will not support True/False
Reply
#8

Still having some minor difficultys with this command.
Код:
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PPC_PlayerCommands.inc(6) : error 036: empty statement
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PPC_PlayerCommands.inc(16) : error 029: invalid expression, assumed zero
pawn Код:
CMD:boot( playerid, params[] )
{
    new bool:TrunkOpen[MAX_PLAYERS];
    if( !IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, COLOR_RED, "Error: You need to be in a vehicle." );
    {
        if(!TrunkOpen[playerid] == true);//this line is 6
        {
            TrunkOpen[playerid] = false;
            new pVeh;
            new engine,lights,alarm,doors,bonnet,boot,objective;
            pVeh = GetPlayerVehicleID( playerid );
            GetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, 0, objective);
            SendClientMessage(playerid, COLOR_GREY, "Trunk Closed");
        }
        else//line 16
        {
            TrunkOpen[playerid] = true;
            new pVeh;
            new engine,lights,alarm,doors,bonnet,boot,objective;
            pVeh = GetPlayerVehicleID( playerid );
            GetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(pVeh, engine, lights, alarm, doors, bonnet, 1, objective);
            SendClientMessage(playerid, COLOR_GREY, "Trunk Open");
        }
    }
    return 1;
}
I have searched around for fixes with no sucess, anyone know what would be wrong now?
Reply
#9

if(!TrunkOpen[playerid] == true);//this line is 6

change to:

if(!TrunkOpen[playerid] == true)//this line is 6

you have ; outside the brackets for some reason?
Reply
#10

if(condition) // dont have any semicolon because it is not closing just checking and executing files inside it

thanks [LoF]Zak
Reply
#11

Quote:
Originally Posted by [LoF]Zak
Посмотреть сообщение
if(!TrunkOpen[playerid] == true);//this line is 6

change to:

if(!TrunkOpen[playerid] == true)//this line is 6

you have ; outside the brackets for some reason?
Quote:
Originally Posted by Neo Karls
Посмотреть сообщение
if(condition) // dont have any semicolon because it is not closing just checking and executing files inside it

thanks [LoF]Zak

Thanks guys, totally looked over that one lol

Thanks for the help!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)