SA-MP Forums Archive
Problem with bonnet CMD - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with bonnet CMD (/showthread.php?tid=357034)



Problem with bonnet CMD - kaiks - 05.07.2012

Please tell me what's wrong here, it only says that player opens the bonnet, but it won't open it.
pawn Код:
YCMD:bonnet(playerid, params[])
{
    #pragma unused params
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    new vehiclename[128];
    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(bonnet != 1)
                {
                    bonnet = 1;
                    SetVehicleParamsEx(oldcar,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
                    GetVehicleName(vehicleid, vehiclename, sizeof(vehiclename));
                    format(string, sizeof(string), "* %s avab kapoti.", sendername);
                    ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    return 1;
                }
                else
                {
                    bonnet = 0;
                    SetVehicleParamsEx(oldcar,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
                    format(string, sizeof(string), "* %s sulgeb kapoti.", sendername);
                    ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    return 1;
                }
        }
    }
    return bonnet;
}



Re: Problem with bonnet CMD - .FuneraL. - 05.07.2012

Try with playerid, and global var:

pawn Код:
bonnet[playerid] = 1; and bonnet[playerid] = 0;



Re: Problem with bonnet CMD - kaiks - 05.07.2012

Nope, gave me 4 errors.
Idk, lights are working fine, only bonnet and boot doesn't work.