God mode during a certain mode
#1

So, when a players health is equal to or less than 25 and he takes damage - he will be put into Brutal M mode. Brutal M is the first stage of the death.

PHP код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
       new 
DeathB;
    new 
DeathS[128];
    new 
Float:PlayerHealth;
    
GetPlayerHealth(playeridPlayerHealth);
    if(
amount PlayerHealth) {
    
SetPlayerHealth(playerid24);
    return 
0;
    }
    if (
PlayerHealth amount <= 25)
    {
        if(
Character[playerid][BrutalM] == 0)
           {
            
GetPlayerPos(playeridBMPos[playerid][0], BMPos[playerid][1], BMPos[playerid][2]);
            
Character[playerid][BrutalM] = 1;
            
Character[playerid][CanAccept] = 0;
            
LegHit[playerid] = 0;
            
format(DTextSsizeof(DTextS), "(( %s is currently injured, type /damages %i for more info. ))"GetName(playerid), playerid);
            
label[playerid] = Create3DTextLabel(DTextSCOLOR_REDBMPos[playerid][0], BMPos[playerid][1], BMPos[playerid][2], 10.00);
            
Attach3DTextLabelToPlayer(label[playerid], playerid000.7); 
The second stage is dead mode, which when a player is in BrutalM mode and he takes damage again - he will go into Dead mode.
PHP код:
    if(Character[playerid][BrutalM] == 1)
            
GetPlayerPos(playeridDPos2[playerid][0], DPos2[playerid][1], DPos2[playerid][2]);
            
Delete3DTextLabel(label[playerid]);
            
label2[playerid] = Create3DTextLabel("(( THIS PLAYER IS NOW DEAD ))"COLOR_REDDPos2[playerid][0], DPos2[playerid][1], DPos2[playerid][2], 10.00);
            
Attach3DTextLabelToPlayer(label2[playerid], playerid000.7);
            
Character[playerid][Dead] = 1;
            
Character[playerid][BrutalM] = 0;
            
SCM(playeridCOLOR_YELLOW">> You are now dead. You can use /respawnme after 60 seconds to respawn.");
            
Character[playerid][CanSpawn] = 0;
            
KillTimer(DeathT);
            
RespawnT 60;
            
RespawnEx SetTimer("RespawnTimer"999true);
            
RTimer SetTimerEx("RespawnTimer2"60000false"i"playerid);
    } 
The issue is, if a player is being shot at by an M4/AK (automatic weapons), when he goes into BrutalM mode he will instantly go into Dead mode due to the fact he is being sprayed at. I was wondering if it's possible to maybe add a timer, or even a way to prevent the player taking damage for about 5 seconds. Thanks in advanced.
Reply
#2

Yes, it's possible. When you set a player to brutally wounded, for example, do:
PHP код:
PlayerData[playerid][pExecuteTime] = 1;
public 
YOUR_TIMER_HERE
{
    foreach(new 
Player){
     if(
PlayerData[i][pExecuteTime]){
            
PlayerData[i][pExecuteTime]++;
            if(
PlayerData[i][pExecuteTime] == 5){
                
PlayerData[i][pExecuteTime] = 0;
            }
        }
    }

Add to:
PHP код:
   if(Character[playerid][BrutalM] == && !PlayerData[playerid][pExecuteTime]) 
Reply
#3

Can't seem to do that, anyone have any other ideas?
Reply
#4

http://forum.sa-mp.com/showpost.php?...98&postcount=2
I don't understand why are you creating 2 threads with almost exactly the same code,You don't learn huh?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)