This command isnt doing what its suppose to be doing
#1

pawn Код:
CMD:trunk(playerid,params[])
{
    new vid;
    vid = GetPlayerVehicleID(playerid);
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
   
    if(boot)
    {
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,true,objective);
        SCM(playerid,COLOR_LIGHTRED,"You Have Poped The Trunk!");
    }
    else
    {
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,false,objective);
        SCM(playerid,COLOR_LIGHTRED,"You Have Closed The Trunk!");
    }
    return 1;
}
What is wrong with that command? its suppose to open trunk if the trunk is closed. and close trunk if trunk is open. All it does is open it
Reply
#2

If boot is open, open the boot again? That's what your script is doing. Fix:

pawn Код:
if(!boot)
Reply
#3

Hmm, I even dunno what a trunk is!^^

But why this?

PHP код:
if(!boot
Double opening boot?^^

Try making an extra command!

pawn Код:
CMD:trunkclose(playerid,params[])
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,false,objective);
SCM(playerid,COLOR_LIGHTRED,"You Have Closed The Trunk!");
return 1;
}
Don't forget the variables!
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
If boot is open, open the boot again? That's what your script is doing. Fix:

pawn Код:
if(!boot)
Okay, thanks. Also

print("Starting timer...");
SetTimerEx("message", 1000, false, "is", 1337, "hello!");
}


Can you tell me what the 1337 is? An if i actually need that
Reply
#5

Depends on what the function message is actually doing. Can't tell without seeing the function header first.
Reply
#6

Quote:
Originally Posted by samtey
Посмотреть сообщение
Hmm, I even dunno what a trunk is!^^

But why this?

PHP код:
if(!boot
Double opening boot?^^

Try making an extra command!

pawn Код:
CMD:trunkclose(playerid,params[])
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,false,objective);
SCM(playerid,COLOR_LIGHTRED,"You Have Closed The Trunk!");
return 1;
}
Don't forget the variables!
Why in living hell would i make a second command for this? I think the script would be more professional if it was done like this. Also, a good helper wouldn't tell anyone to just go the easy way and make that kind of command.

@Vice

https://sampwiki.blast.hk/wiki/SetTimerEx Im going off of that
Reply
#7

Read the params.
SetTimerEx("message", 1000, false, "is", 1337, "hello!")

funcname[] Name of the function to call.
interval Interval in milliseconds.
repeating Boolean if the timer should occur repeatedly or only once
format[] Special format indicating the types of values the timer will carry
{Float,_}:... Indefinite number of arguments to pass

first param is for the function name, next is for the time, then if its going to repeat, then the format... similar to sscanf, if the header of your function was Kill(playerid) then you'd need to do

SetTimerEx("Kill", 1000, true, "i", playerid);
i being integer, and playerid being the integer we want to pass onto the function
Reply
#8

Try this boot command (trunk)

pawn Код:
CMD:trunk(playerid, params[])
{
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new oldcar = gLastCar[playerid];
    new Float:cX, Float:cY, Float:cZ;
    GetVehicleParamsEx(oldcar, engine, lights, alarm, doors, bonnet, boot, objective);
    GetVehiclePos(oldcar, cX, cY, cZ);
    new vehicleid = GetPlayerVehicleID(playerid);
    if(!IsAPlane(vehicleid) || !IsAHelicopter(vehicleid) || !IsABike(vehicleid) || !IsATrain(vehicleid) || !IsABoat(vehicleid))
    {
        if(IsPlayerDriver(playerid) || IsPlayerInRangeOfPoint(playerid, 5, cX+2, cY, cZ))
                {
                    if(boot != 1)
                    {
                        boot = 1;
                        SetVehicleParamsEx(oldcar,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
                        SendClientMessage(playerid, 0xFFFFFFAA, "[Vehicle Control] You've opened the trunk!");
                        format(string, sizeof(string), "* %s opens up the trunk of the car.", sendername);
                        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                    else
                    {
                        boot = 0;
                        SetVehicleParamsEx(oldcar,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
                        SendClientMessage(playerid, 0xFFFFFFAA, "[Vehicle Control] You've shut the trunk!");
                        format(string, sizeof(string), "* %s closes the trunk of the car.", sendername);
                        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
            }
        }
    return boot;
}


stock IsPlayerDriver(playerid)
{
    if(IsPlayerConnected(playerid) && GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
    {
        return 1;
    }
    return 0;
}
Works for me, hopefully works for you too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)