SA-MP Forums Archive
How to improve this function - 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: How to improve this function (/showthread.php?tid=427492)



How to improve this function - NinjaChicken - 01.04.2013

ALright i have this

pawn Код:
public OnEmptyVehicleDamage(vehicleid,playerid,exems)
{
    ChangeVehicleColor(vehicleid,random(126),random(126));
    return 1;
}
but i want to make it only a level 7 admin, with a desert eagle can shoot the car to make it change colours

i use pAdmin as the player saving thingy also


Re: How to improve this function - glbracer - 01.04.2013

First, it shouldn't be a public function unless it's a timer, it's a waste of CPU.
Secondly, you'd require if() statements for that.
pawn Код:
// Place under OnPlayerKeyStateChange
if(PlayerInfo[playerid][pAdmin] >= 7 && GetPlayerWeapon(playerid) == 24)
{
  new vehicleid = GetVehiclePlayerIsAimingAt(playerid); // Find a stock function for this, should be pretty simple, try this.
  ChangeVehicleColor(vehicleid, random(126), random(126);
}



Re: How to improve this function - MP2 - 02.04.2013

Do note that you can't damage un-occupied vehicles.


Re: How to improve this function - NinjaChicken - 02.04.2013

https://sampforum.blast.hk/showthread.php?tid=271903


Re: How to improve this function - MP2 - 02.04.2013

Okay, let me rephrase.

Quote:
Originally Posted by MP2
Посмотреть сообщение
Do note that you can't accurately or reliably detect the damage of un-occupied vehicles.



Re: How to improve this function - glbracer - 02.04.2013

Quote:
Originally Posted by MP2
Посмотреть сообщение
Okay, let me rephrase.
Even at that, I don't think that's what he's looking for. I think he's just looking to make it so a level 7 admin and up can shoot a vehicle with a Desert Eagle and have it change the vehicle's color. For shits and giggles, as there's no logical reason to make it do that, oh well.