vendredi 15 juillet 2016

[Tutorial] HOW TO CREATE SIMPLE ANTI GODMODE

I made this code for player default hp

PHP Code:

new HP[MAX_PLAYERS] = 100

So Now We Are Going To Make Simple Damage System which looks like

PHP Code:

public OnPlayerTakeDamage(playeridissueridFloatamountweaponid)
{
    if(
issuerid == INVALID_PLAYERID)////////// THIS MEANS PLAYER FALLED OUT OR SOMETHING ELSE
    
{
        new 
randomhp[MAX_PLAYERS] = random(20);
        
HP[playerid] -= randomhp[playerid];
        
SetPlayerHealth(playeridHP[playerid])
    }
    if(
weaponid == 0)
     {
         
HP[playerid] -= 5;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 1)
    {
         
HP[playerid] -= 8;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 2)
    {
         
HP[playerid] -= 10;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 3)
    {
         
HP[playerid] -= 10;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 4)
    {
         
HP[playerid] -= 15;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 5)
    {
         
HP[playerid] -= 13;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 6)
    {
         
HP[playerid] -= 10;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 7)
    {
         
HP[playerid] -= 10;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 8)
    {
         
HP[playerid] -= 20;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 9)
    {
         
HP[playerid] -= 25;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 10)
    {
         
HP[playerid] -= 50;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 11)
    {
         
HP[playerid] -= 20;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 12)
    {
         
HP[playerid] -= 25;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 13)
    {
         
HP[playerid] -= 25;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 16)
    {
         
HP[playerid] -= 70;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 22)
    {
         
HP[playerid] -= 25;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 25)
    {
         
HP[playerid] -= 25;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 24)
    {
         
HP[playerid] -= 49;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 26)
    {
         
HP[playerid] -= 35;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 27)
    {
         
HP[playerid] -= 35;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 28)
    {
         
HP[playerid] -= 15;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 29)
    {
         
HP[playerid] -= 25;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 30)
    {
         
HP[playerid] -= 25;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 31)
    {
         
HP[playerid] -= 25;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 32)
    {
         
HP[playerid] -= 15;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 33)
    {
         
HP[playerid] -= 35;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    if(
weaponid == 34)
    {
         
HP[playerid] -= 50;
         
SetPlayerHealth(playeridHP[playerid]);
     }
    return 
1;

This Code Will Set Player Health To HP[playerid]

PHP Code:

SetPlayerHealth(playeridHP[playerid]); 

And When HP[playerid] Will Be 0 Player Will Died.
I Made This Script For My Gamemode And Its Works.

This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at http://ift.tt/jcXqJW.
Recommended article from FiveFilters.org: Most Labour MPs in the UK Are Revolting.



[Tutorial] HOW TO CREATE SIMPLE ANTI GODMODE

Aucun commentaire:

Enregistrer un commentaire