How to improve this function
#1

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
Reply
#2

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);
}
Reply
#3

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

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

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.
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)