Car commands help
#4

pawn Код:
command(car, playerid, params[])
{
    if(isnull(params))
    {
        SendClientMessage(playerid, WHITE, "SYTNAX: /car [usage]");
        SendClientMessage(playerid, WHITE, "USAGES: hood, lights, trunk.");
    }
    else
    {
        new closestid = GetClosestCar(playerid, 5);
        new vehicleid = GetPlayerVehicleID(playerid);


        new Float:x, Float:y, Float:z;

        new engine, lights, alarm, doors, bonnet, boot, objective;
        new e, l, a, d, b, be, o;

        new string[256];

        GetVehicleParamsEx(closestid, vid,engine,lights,alarm,doors,bonnet, boot,objective);
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);


        GetVehiclePos(vehicleid, x, y, z);

        if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z-3))
        {
            if(strcmp(params, "hood", true) == 0)
            {
                if(Vehicles[closestid][Hood] == 0)
                {
                    Vehicles[closestid][Hood] = 1;
                    format(string, 256, "* %s opens the hood of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, 1, boot, objective);
                }
                else if(Vehicles[closestid][Hood] == 1)
                {
                    Vehicles[closestid][Hood] = 0;
                    format(string, 256, "* %s closes the hood of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, 0, boot, objective);
                }
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z+3))
        {
            if(strcmp(params, "trunk", true) == 0)
            {
                if(Vehicles[closestid][Trunk] == 0)
                {
                    Vehicles[closestid][Trunk] = 1;
                    format(string, 256, "* %s extends his right arm towards the trunk, opening the trunk of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, bonnet, 1, objective);
                }
                else if(Vehicles[closestid][Trunk] == 1)
                {
                    Vehicles[closestid][Trunk] = 0;
                    format(string, 256, "* %s closes the hood of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, bonnet, 0, objective);
                }
            }
        }
    }
Not tested - should work.
Reply


Messages In This Thread
Car commands help - by arko123 - 07.10.2012, 08:04
Re: Car commands help - by ~Pawno~ - 07.10.2012, 08:06
Re: Car commands help - by arko123 - 07.10.2012, 08:10
Re: Car commands help - by Smally - 07.10.2012, 08:16
Re: Car commands help - by arko123 - 07.10.2012, 08:31
Re: Car commands help - by Smally - 07.10.2012, 08:39
Re: Car commands help - by arko123 - 07.10.2012, 08:42
Re: Car commands help - by Smally - 07.10.2012, 08:45
Re: Car commands help - by arko123 - 07.10.2012, 14:15

Forum Jump:


Users browsing this thread: 1 Guest(s)