Post by Gaspatcho on Jun 28, 2020 23:38:15 GMT
I'm making this for iskandar and for anyone else who wonders how the thing is done. this is for newbies or anyone who can't figure a way to do it
I will take the golden ak as example and turn it into a frozen ak or some shit like that.
Requirements:
-A mode which contain natives which can freeze/burn, I will use zp 5.0 natives as an example.
* We will use the Ham_Takedamage function, for Golden-AK it will be
we will need to edit it using the following, but first you will need the include which have the natives to be added to the includes list.
We will create a variable which will hold the damage done and use it calculate when the freeze should happen, simply do this. also this goes for both forwards.
1- We add up the damage to our variable.
That's all about it, you might want to make a function to unfreeze the player after few seconds and then call it.
Overall, our new code should look like this
Later.
I will take the golden ak as example and turn it into a frozen ak or some shit like that.
Requirements:
-A mode which contain natives which can freeze/burn, I will use zp 5.0 natives as an example.
Method 1: (Damage)
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
#If we don't, we can just create one,public client_damage(id,victim,damage,wpnindex,hitplace,TA)
but there is a difference in here, in the ham function, the damage is float, it is not a float in the client_damage forward.we will need to edit it using the following, but first you will need the include which have the natives to be added to the includes list.
We will create a variable which will hold the damage done and use it calculate when the freeze should happen, simply do this. also this goes for both forwards.
new DamageDone[33]
Then we will need to use that using if conditions. ONLY USE ONE. DON"T USE BOTH.1- We add up the damage to our variable.
DamageDone[id] += floatround(damage) //This is for the first forward (fw_TakeDamage)
DamageDone[id] += damage //This is for the second forward (client_damage)
2- if conditions, this goes for both forwards. for me, I will freeze the zombie if the player damage hits a thousand.if(DamageDone[id] >= 1000) //we will do our thing, this one will freeze our zombie and then reset the variable back to 0.
{
if(zp_core_is_zombie(id))
zp_grenade_frost_set(victim, true)
DamageDone[id] = 0
}
That's all about it, you might want to make a function to unfreeze the player after few seconds and then call it.
Overall, our new code should look like this
new DamageDone[33]
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
{
DamageDone[id] += floatround(damage)
if(DamageDone[id] >= 1000)
{
if(zp_core_is_zombie(id))
zp_grenade_frost_set(victim, true)
set_task(1.0,"Task_Unfreeze",id)
DamageDone[id] = 0
}
SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
}
}
public Task_Unfreeze(id)
{
if(is_user_alive(id))
zp_grenade_frost_set(id, false)
}
Method 2: (Game time)