Map Icon/Car damage help
#1

How would i go about making icons for the full SA map as i have tried the ingame icon makers yet they only allow 1 icon at an time... and adding an script into the gm that allows flat tires and no driver car damage...?
Reply
#2

For map icon, use streamer plugin and this function:
PHP код:
CreateDynamicMapIcon(Float:xFloat:yFloat:ztypecolorworldid = -1interiorid = -1playerid = -1Float:streamdistance 100.0style MAPICON_LOCAL); 
For no car damage, add this code under OnPlayerUpdate
PHP код:
if(IsPlayerInAnyVehicle(playerid))
{
    
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);

Reply
#3

ah thanks ++rep but for the car damage i meant if noone is driving the car and it gets shot etc it can still get blown up
Reply
#4

Can you explain more about the car damage?
Reply
#5

ok like you are driving an car.... and you decide to get out and shoot it..... it will blow up and wont be blow up proof when no driver is in it
Reply
#6

So, when there are no player or players are in car, will it blow up?
Reply
#7

yes like that if the car has no driver it can still be blown up
Reply
#8

You can use the callback 'OnPlayerWeaponShot' for that. Although take note that weapons such as baseball bats and chainsaws and weapons that aren't necessarily "Shot" will not be valid for use in this callback.

An example:
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_VEHICLE) //If the player's shot hit a vehicle
    {
        new bool:occupied = false, Float:HIT_DAMAGE = 25.0; //Vehicle is NOT occupied by default. If we do hit the vehicle, hit damage will do 25.0 damage.
        for(new i = 0; i < MAX_PLAYERS; i++) //Loop through all players.
        {
            if(!IsPlayerConnected(i)) continue; //Skip players that aren't connected.
            if(IsPlayerInVehicle(i, hitid) && GetPlayerState(i) == PLAYER_STATE_DRIVER) //If the player is driving the vehicle we shot.
            {
                occupied = true; //The vehicle we shot was occupied by a driver.
                break; //Break the loop, as we already know someone was driving.
            }
        }
        if(!occupied) //If the vehicle was not occupied by a driver...
        {
            new Float:CarHealth; //A variable to store the vehicle's original health.
            GetVehicleHealth(hitid, CarHealth); //Get the vehicle's current health.
            if((CarHealth - HIT_DAMAGE) > 0) SetVehicleHealth(hitid, CarHealth - HIT_DAMAGE); //Apply the hit damage to the vehicle to reduce its health.
        }
    }
    return 1;
}
Note that 'HIT_DAMAGE' is the amount of damage that each bullet will do to the vehicle. Feel free to change this as you wish, as you can also do variable damages depending on what weapon the player is using.

References:
https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot
Reply
#9

Quote:
Originally Posted by Threshold
Посмотреть сообщение
You can use the callback 'OnPlayerWeaponShot' for that. Although take note that weapons such as baseball bats and chainsaws and weapons that aren't necessarily "Shot" will not be valid for use in this callback.

An example:
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_VEHICLE) //If the player's shot hit a vehicle
    {
        new bool:occupied = false, Float:HIT_DAMAGE = 25.0; //Vehicle is NOT occupied by default. If we do hit the vehicle, hit damage will do 25.0 damage.
        for(new i = 0; i < MAX_PLAYERS; i++) //Loop through all players.
        {
            if(!IsPlayerConnected(i)) continue; //Skip players that aren't connected.
            if(IsPlayerInVehicle(i, hitid) && GetPlayerState(i) == PLAYER_STATE_DRIVER) //If the player is driving the vehicle we shot.
            {
                occupied = true; //The vehicle we shot was occupied by a driver.
                break; //Break the loop, as we already know someone was driving.
            }
        }
        if(!occupied) //If the vehicle was not occupied by a driver...
        {
            new Float:CarHealth; //A variable to store the vehicle's original health.
            GetVehicleHealth(hitid, CarHealth); //Get the vehicle's current health.
            if((CarHealth - HIT_DAMAGE) > 0) SetVehicleHealth(hitid, CarHealth - HIT_DAMAGE); //Apply the hit damage to the vehicle to reduce its health.
        }
    }
    return 1;
}
Note that 'HIT_DAMAGE' is the amount of damage that each bullet will do to the vehicle. Feel free to change this as you wish, as you can also do variable damages depending on what weapon the player is using.

References:
https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot
THANKS!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)