Godmode help
#1

Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    if(PlayerVar[damagedid][Godmode] == 1)
    {
        SetPlayerHealth(damagedid,100);
    }
    return 1;
}
It works great but whenever the player falls off a building he dies. How can I make this system better?
Reply
#2

pawn Код:
This gonna help u
CMD:god(playerid, params[])
{
    if(PlayerInfo[playerid][World] == TDMWorldID) return SendClientMessage(playerid, COLOR_RED, "you can't use this command in this world");
    if(PlayerInfo[playerid][World] == DMWorldID) return SendClientMessage(playerid, COLOR_RED, "ERROR: you may not use this command in the Deathmatch World!");
    if(PlayerInfo[playerid][AdminLevel] >= 3)
    {
        SendCommandToAdmins(playerid,"/god");
        if(PlayerInfo[playerid][GodMode] == false)
        {
            SetPlayerHealth(playerid, 99999999);
            SendClientMessage(playerid, COLOR_GREEN, "GodMode ON!");
            PlayerInfo[playerid][GodMode] = true;
        }
        else if(PlayerInfo[playerid][GodMode] == true)
        {
            SetPlayerHealth(playerid, 100);
            SendClientMessage(playerid, COLOR_RED, "GodMode OFF!");
            PlayerInfo[playerid][GodMode] = false;
        }
    }
    else return SendClientMessage(playerid, COLOR_RED, "ERROR: you need to be atleast Admin Level 3 to use this command");
    return 1;
}
Reply
#3

set godmode health to like 9999
Reply
#4

^ Those didn't help me, I know how to script guys, only thing is whenever he gets lots of damage at once he dies anyways
Reply
#5

try OnPlayerTakeDamage rather than OnPlayerGiveDamage.

EDIT: or get Sabrina to hit me up on skype and I'll fix it for you bud.
Reply
#6

You could add it under OnPlayerUpdate();.
If godmode is on, set the HP to X.
Reply
#7

Why doesn't you use something like this?

pawn Код:
CMD:god(playerid, params[])
{
    if(!IsCnRAdmin(playerid)) return UnknownCMD(playerid);
    if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
    if(IsSpecing[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Spectating.");
    if(God[playerid] == 0)
        {
                God[playerid] = 1;
                SetPlayerHealth(playerid, 100000);
                SendClientMessage(playerid, COLOR_GREEN, "God Mode ON.");
                GivePlayerWeapon(playerid, 38, 100000);
                AdminCMD(playerid, "GOD");
        }
        else
        {
                God[playerid] = 0;
                SetPlayerHealth(playerid, 100);
                SendClientMessage(playerid, COLOR_GREEN, "God Mode OFF.");
                GivePlayerWeapon(playerid, 35, 0);
        }
    new log[256];
    format(log, sizeof log, "Admin %s Has Used God", PlayerName(playerid));
    LogToFile("god", log);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)