[HELP] Freeze and Timers
#2

Quote:
Originally Posted by WThieves
Hi everyone , Sorry to bother you again but this time yet i have another request!
I was making a piece of script for my GM.
It works good except for a few pieces....
i have this:
Quote:

if (strcmp(cmd, "/Udst!2", true) ==0 )
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
SetPlayerHealth(playerid,100000000);
if(IsPlayerInAnyVehicle(playerid)) SetVehicleHealth(GetPlayerVehicleID(playerid),1000 000000);
SendClientMessage(playerid, COLOR_YELLOW, "You are in godmode for 60 seconds!");
SetTimer("Stopgod", 60000, 0);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}

As you can see, this makes an admin invincible for at least 60 seconds!
1: Now my request, if an admin uses this command it can repeadly use it and it wil be invurnable for ever, as i don't want this, i would like to have a timer that makes it so that you can use this command again only after 120 seconds!
I've tried this on my own but i cant do it and i also searched the forum but with no results i can use
If someone could write this i would appreciate it!
2: If an admin uses this command, i would like it if every player an a range of 50 could freeze for like 10 seconds.
Well i tried that too but id didnt work either

So if someone could help me out here i'd be happy to see ;P

PS: if the freezing could be an explosion too, that could blow everyone away in a range of 50, sort of protection :P
make public

something like this

on top of your script:

Код:
forward Stopgod( );
then public

Код:
public Stopgod( )
{
  for(new playerid, gmax = GetMaxPlayers(); playerid < gmax; playerid++)
  {
    SetPlayerHealth(playerid, 100);
    god[playerid] = 0;
	}
}
And for the second thing im not sure how to make it, so i dont gonna reply to that.

Edit:

On top of script

Код:
new god[MAX_PLAYERS];
Код:
if (strcmp(cmd, "/Udst!2", true) ==0 )
	{
 		if(PlayerInfo[playerid][pAdmin] >= 1337)
        if(god[playerid] == 0)
 		{
           god[playerid] = 1;			
SetPlayerHealth(playerid,100000000);
			if(IsPlayerInAnyVehicle(playerid)) SetVehicleHealth(GetPlayerVehicleID(playerid),1000000000);
			SendClientMessage(playerid, COLOR_YELLOW, "You are in godmode for 60 seconds!");
			SetTimer("Stopgod", 60000, 0);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD1, "  You are not authorized to use that command or you have to wait 60 seconds !");
		}
Reply


Messages In This Thread
[HELP] Freeze and Timers - by WThieves - 21.12.2009, 22:41
Re: [HELP] Freeze and Timers - by kamilbam - 21.12.2009, 23:04
Re: [HELP] Freeze and Timers - by WThieves - 21.12.2009, 23:54
Re: [HELP] Freeze and Timers - by kamilbam - 22.12.2009, 01:01
Re: [HELP] Freeze and Timers - by WThieves - 22.12.2009, 09:34
Re: [HELP] Freeze and Timers - by kamilbam - 22.12.2009, 10:43
Re: [HELP] Freeze and Timers - by WThieves - 22.12.2009, 14:05
Re: [HELP] Freeze and Timers - by Deat_Itself - 22.12.2009, 15:33
Re: [HELP] Freeze and Timers - by WThieves - 22.12.2009, 17:18
Re: [HELP] Freeze and Timers - by WThieves - 22.12.2009, 20:23

Forum Jump:


Users browsing this thread: 1 Guest(s)