GodMode
#1

Hey, I have a command for god on/off. I want when a player have /god and kill someone automatically his health set to 0 and die. How can i do this.
pawn Код:
if (strcmp("/godon", cmdtext, true, 10) == 0)
 {
    SendClientMessage(playerid,0xAA3333AA,">>");
    SendClientMessage(playerid,COLOR_RED,"GodMod ON!");
    SetPlayerHealth(playerid,99999);
    return 1;
 }


 if (strcmp("/godoff", cmdtext, true, 10) == 0)
 {
    SendClientMessage(playerid,0xAA3333AA,">>");
    SendClientMessage(playerid,COLOR_RED,"GodMod OFF!");
    SetPlayerHealth(playerid,100);
    return 1;
 }
Reply
#2

pawn Код:
new bool:GodOrder[MAX_PLAYERS];

if (strcmp("/godon", cmdtext, true, 10) == 0)
 {
    SendClientMessage(playerid,0xAA3333AA,">>");
    SendClientMessage(playerid,COLOR_RED,"GodMod ON!");
    SetPlayerHealth(playerid,99999);
    GodOrder[playerid] = true;
    return 1;
 }


if (strcmp("/godoff", cmdtext, true, 10) == 0)
{
    SendClientMessage(playerid,0xAA3333AA,">>");
    SendClientMessage(playerid,COLOR_RED,"GodMod OFF!");
    SetPlayerHealth(playerid,100);
    GodOrder[playerid] = false;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if (GorOrder[killerid])
    {
        SetPlayerHealth(killerid, -1);
        GorOrder[killerid] = false;
    }
    return 1;
}
Reply
#3

pawn Код:
new bool: God[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
    if(God[killerid] == true && killerid != INVALID_PLAYER_ID)
    {
        SetPlayerHealth(killerid, 0);
        God[killerid] = false;
    }
    return 1;
}
    if (strcmp("/godon", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid,0xAA3333AA,">>");
        SendClientMessage(playerid,COLOR_RED,"GodMod ON!");
        SetPlayerHealth(playerid,99999);
        God[playerid] = true;
        return 1;
    }  


    if (strcmp("/godoff", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid,0xAA3333AA,">>");
        SendClientMessage(playerid,COLOR_RED,"GodMod OFF!");
        SetPlayerHealth(playerid,100);
        God[playerid] = false;
        return 1;
    }
EDIT: User above was faster
Reply
#4

Thanks!
Reply
#5

By the way, your script isn't really a godmode. I can easy kill you with a minigun or something else. Use a timer for that.
Reply
#6

pawn Код:
#define INFINITY (Float:0x7F800000)
pawn Код:
SetPlayerHealth(playerid, INFINITY);
That is really god mode, you cannot die.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)