help with some commands
#1

So basically I'm creating a gm now, how do I create it with timers(10 seconds)? cus sometimes they'll just escape death.

you know /god command right? It becomes ON and OFF. so how do I do it? If I set his health into 10000 how do I reset his old health? [NOTE: +REP]
Reply
#2

Quote:
Originally Posted by Extraordinariness
Посмотреть сообщение
So basically I'm creating a gm now, how do I create it with timers(10 seconds)? cus sometimes they'll just escape death.

you know /god command right? It becomes ON and OFF. so how do I do it? If I set his health into 10000 how do I reset his old health? [NOTE: +REP]
Try:
pawn Код:
new OldHealth[MAX_PLAYERS];
new bool:GodMode[MAX_PLAYERS]; //New variable to store old health

// Then in a command... (zcmd for example)
CMD:god(playerid, params[])
{
//if admin blah blah blah;
   if (GodMode[playerid] == false)
   {
      GetPlayerHealth(playerid, OldHealth[playerid]);
      SetPlayerHealth(playerid, 10000);
      GodMode = true;
   }
   else
   {
      SetPlayerHealth(playerid, OldHealth[playerid]);
      GodMode = false;
   }
   return 1;
}
*This is untested, it may not work perfectly, but you get the idea if you have even the most basic of pawno knowledge.
Reply
#3

Close.

pawn Код:
new Float:OldHealth[MAX_PLAYERS]; //This will store the player's original health.
new bool:GodMode[MAX_PLAYERS]; //This will determine whether the player has godmode activated or not.

public OnPlayerConnect(playerid)
{
    OldHealth[playerid] = 100.0;
    GodMode[playerid] = false;
    return 1;
}

// Then in a command... (zcmd for example)
CMD:god(playerid, params[])
{
    //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "Only administrators can use this command.");
   if(!GodMode[playerid])
   {
      GetPlayerHealth(playerid, OldHealth[playerid]);
      SetPlayerHealth(playerid, (Float:0x7F800000));
      GodMode[playerid] = true;
   }
   else if(GodMode[playerid])
   {
      SetPlayerHealth(playerid, OldHealth[playerid]);
      GodMode[playerid] = false;
   }
   return 1;
}
Reply
#4

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Close.

pawn Код:
new Float:OldHealth[MAX_PLAYERS]; //This will store the player's original health.
new bool:GodMode[MAX_PLAYERS]; //This will determine whether the player has godmode activated or not.

public OnPlayerConnect(playerid)
{
    OldHealth[playerid] = 100.0;
    GodMode[playerid] = false;
    return 1;
}

// Then in a command... (zcmd for example)
CMD:god(playerid, params[])
{
    //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "Only administrators can use this command.");
   if(!GodMode[playerid])
   {
      GetPlayerHealth(playerid, OldHealth[playerid]);
      SetPlayerHealth(playerid, (Float:0x7F800000));
      GodMode[playerid] = true;
   }
   else if(GodMode[playerid])
   {
      SetPlayerHealth(playerid, OldHealth[playerid]);
      GodMode[playerid] = false;
   }
   return 1;
}
OBJECTION!
Not quite, is he asking for the playerid that typed the command, or for the command to select which playerid to godmode?
Reply
#5

No, he isn't. So he has what he wanted.
Reply
#6

Thanks, for everyone helpewd.+repped all I can.
SORRY, I forgot the thread so I just checked this out now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)