SA-MP Forums Archive
Remove 5 Car Doors - 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: Remove 5 Car Doors (/showthread.php?tid=653414)



Remove 5 Car Doors - bookknp - 04.05.2018

I need CMD for remove all 5 doors from the car, Someone can help me??


Re: Remove 5 Car Doors - CrystalGamer - 04.05.2018

5 doors?
i saw 4, 2 only huh but from where the 5 came lol? huh
Edit: today i knew it


Re: Remove 5 Car Doors - Dayrion - 04.05.2018

https://sampwiki.blast.hk/wiki/UpdateVehicleDamageStatus
Than
https://sampwiki.blast.hk/wiki/DoorStates


Re: Remove 5 Car Doors - bookknp - 04.05.2018

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Thx, friend. Im using this code but dont work, do u know why dont work??

Код:
CMD:bb(playerid, vehicleid, params[])
{
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, 111, lights, tires); 
return 1;
}



Re: Remove 5 Car Doors - NaS - 04.05.2018

Quote:
Originally Posted by bookknp
Посмотреть сообщение
Thx, friend. Im using this code but dont work, do u know why dont work??

Код:
CMD:bb(playerid, vehicleid, params[])
{
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, 111, lights, tires); 
return 1;
}
The values for the doors are displayed in bits, so 111 shouldn't be a decimal number but binary.

111 in binary equals 7 in decimal, so to toggle all doors you need to use the value 7 or write it in binary format:

Код:
UpdateVehicleDamageStatus(vehicleid, panels, 0b111, lights, tires);



Re: Remove 5 Car Doors - bookknp - 04.05.2018

Quote:
Originally Posted by NaS
Посмотреть сообщение
The values for the doors are displayed in bits, so 111 shouldn't be a decimal number but binary.

111 in binary equals 7 in decimal, so to toggle all doors you need to use the value 7 or write it in binary format:

Код:
UpdateVehicleDamageStatus(vehicleid, panels, 0b111, lights, tires);
Thx, Why dont remove car doors ??


Re: Remove 5 Car Doors - Dayrion - 04.05.2018

Quote:
Originally Posted by bookknp
Посмотреть сообщение
Thx, Why dont remove car doors ??
That's a bit more tricky and if you have read what it wronte on the wiki, your code is false.

PHP код:
CMD:dda(playeridparams[])
{
    if(!
IsPlayerInAnyVehicle(playerid))
        return 
1;
    new 
panelsdoorslightstires,
        
vehicleid GetPlayerVehicleID(playerid);
        
    
GetVehicleDamageStatus(vehicleidpanelsdoorslightstires);
    
UpdateVehicleDamageStatus(vehicleidpanelsdoors | (0b100 << 16) | (0b100 << 24), lightstires);
    return 
1;




Re: Remove 5 Car Doors - Dayrion - 04.05.2018

There is actually 4 byte and not 5. Remove the last one (40). Otherwise, that should works. Here you go


Re: Remove 5 Car Doors - bookknp - 04.05.2018

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
There is actually 4 byte and not 5. Remove the last one (40). Otherwise, that should works. Here you go
This door cant be removed??




Re: Remove 5 Car Doors - Dayrion - 05.05.2018

No'p you can't.
About your code :
PHP код:
CMD:bb(playeridparams[])
{
if(!
IsPlayerInAnyVehicle(playerid))
        return 
1;
    new 
panelsdoorslightstires,
        
vehicleid GetPlayerVehicleID(playerid);
    
GetVehicleDamageStatus(vehicleidpanelsdoorslightstires);
    
UpdateVehicleDamageStatus(vehicleidpanelsdoors | (0b100 << 8) | (0b100 << 16) | (0b100 << 24)| (0b100 << 32)  , lightstires);
    return 
1;

If you set every byte of "doors", you don't to have "doors |".
PHP код:
UpdateVehicleDamageStatus(vehicleidpanels, (0b100 << 8) | (0b100 << 16) | (0b100 << 24)| (0b100 << 32)  , lightstires);