/trunk command help
#1

So I have a /trunk command but it only opens/close the trunk... But I want it so It would be /trunk open/close

code as of now...
Код:
CMD:trunk(playerid, params[])
{
    new string[128], done, idx;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pVeh] || PlayerInfo[playerid][pVVeh])
    {
        new Float:vx, Float:vy, Float:vz;
        GetVehiclePos(PlayerInfo[playerid][pVeh], vx, vy, vz);
        if(IsPlayerInRangeOfPoint(playerid, 4, vx, vy, vz))
        {
            idx = PlayerInfo[playerid][pVeh];
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, boot, objective);
            if(!boot)
            {

                SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 1, objective);
                format(string, sizeof(string), "* %s opens their vehicle's trunk.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~g~Trunk Opened", 3500, 3);
                topened[playerid] = 1;
            }
            else
            {
                SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 0, objective);
                format(string, sizeof(string), "* %s closes their vehicle's trunk.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~r~Trunk Closed", 3500, 3);
                topened[playerid] = 0;
            }
            done = 1;
            return 1;
        }
        GetVehiclePos(PlayerInfo[playerid][pVVeh], vx, vy, vz);
        if(IsPlayerInRangeOfPoint(playerid, 4, vx, vy, vz))
        {
            idx = PlayerInfo[playerid][pVVeh];
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, boot, objective);
            if(!boot)
            {

                SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 1, objective);
                format(string, sizeof(string), "* %s opens their vehicle's trunk.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~g~Trunk Opened", 3500, 3);
                topened[playerid] = 1;
            }
            else
            {
                SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 0, objective);
                format(string, sizeof(string), "* %s closes their vehicle's trunk.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~r~Trunk Closed", 3500, 3);
                topened[playerid] = 0;
            }
            done = 1;
        }
        if(!done) SendClientMessage(playerid, COLOR_GREY, "You are not near a vehicle you own.");
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You don't own any vehicle.");
        return 1;
    }
    return 1;
}
how i want it...
Код:
CMD:trunk(playerid, params[])
{
    new string[128], done, idx;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pVeh] || PlayerInfo[playerid][pVVeh])
    {
        SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /trunk [open/close]");
        SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /trunk [balance/upgrade]");
        SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /trunk [deposit/withdraw] [type] [amount]");
        SendClientMessage(playerid, COLOR_GREY, "** Upgrading a trunk costs $25,000 each new level.");
        return 1;
    }
    if(!strcmp(params, "open", true))
    {

    }
    else if(!strcmp(params, "close", true))
    {

    }
    return 1;
}
Reply
#2

No one can help me?
Reply
#3

pawn Код:
C:boot(playerid, params[])
{
    new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
    vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(!IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, red, "Error: You are not in a vehicle.");
    if(GetPlayerVehicleSeat(playerid) != 0)
        return SendClientMessage(playerid, red, "Error: You are not in the drivers seat.");
    if(boot == 1)
    {
        SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,0,objective);
    }
    else
    {
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,1,objective);
    }
    return 1;
}
Like that?
Reply
#4

Noooo, Did you not understand what i asked above?
Reply
#5

Not tested...
pawn Код:
CMD:trunk(playerid, params[])
{
    new string[128], done, idx;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pVeh] || PlayerInfo[playerid][pVVeh])
    {
        SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /trunk [open/close]");
        SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /trunk [balance/upgrade]");
        SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /trunk [deposit/withdraw] [type] [amount]");
        SendClientMessage(playerid, COLOR_GREY, "** Upgrading a trunk costs $25,000 each new level.");
        return 1;
    }
    if(!strcmp(params, "open", true))
    {
        new Float:vx, Float:vy, Float:vz;
        GetVehiclePos(PlayerInfo[playerid][pVeh], vx, vy, vz);
        if(IsPlayerInRangeOfPoint(playerid, 4, vx, vy, vz))
        {
            idx = PlayerInfo[playerid][pVeh];
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, boot, objective);
            if(!boot)
            {

                SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 1, objective);
                format(string, sizeof(string), "* %s opens their vehicle's trunk.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~g~Trunk Opened", 3500, 3);
                topened[playerid] = 1;
            }
            else
            {
                SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 0, objective);
                format(string, sizeof(string), "* %s closes their vehicle's trunk.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~r~Trunk Closed", 3500, 3);
                topened[playerid] = 0;
            }
            done = 1;
            return 1;
        }
        GetVehiclePos(PlayerInfo[playerid][pVVeh], vx, vy, vz);
        if(IsPlayerInRangeOfPoint(playerid, 4, vx, vy, vz))
        {
            idx = PlayerInfo[playerid][pVVeh];
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, boot, objective);
            if(!boot)
            {

                SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 1, objective);
                format(string, sizeof(string), "* %s opens their vehicle's trunk.", RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GameTextForPlayer(playerid, "~g~Trunk Opened", 3500, 3);
                topened[playerid] = 1;
            }
        }

    }
    else if(!strcmp(params, "close", true))
    {
        SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 0, objective);
        format(string, sizeof(string), "* %s closes their vehicle's trunk.", RPN(playerid));
        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        GameTextForPlayer(playerid, "~r~Trunk Closed", 3500, 3);
        topened[playerid] = 0;
    }
    return 1;
}
Reply
#6

This Working For Me
Reply
#7

You can easly do that as explained in this post:
http://forum.sa-mp.com/showthread.ph...85#post3980785
Reply
#8

wow guys you replying on 2013 posts GG
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)