[HELP] Freeze and Timers
#1

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
Reply
#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
#3

Quote:
Originally Posted by kamilbam
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 !");
		}
No that's not what i meant!, i have that things already!
Reply
#4

Quote:

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!

Read my post i made that for you

Код:
god[playerid] = 1;
god[playerid] = 0;
and as i said i dont think i know how to make the second thingy.
Reply
#5

Alright i've done my best but i get 3 errors now:
Quote:

*********(9351) : error 017: undefined symbol "god"
*********(9351) : error 001: expected token: ";", but found "]"
*********(9351) : error 029: invalid expression, assumed zero

Reply
#6

Quote:
Originally Posted by WThieves
Alright i've done my best but i get 3 errors now:
Quote:

*********(9351) : error 017: undefined symbol "god"
*********(9351) : error 001: expected token: ";", but found "]"
*********(9351) : error 029: invalid expression, assumed zero

did you make new thingy on top of your script ?

Код:
new god[MAX_PLAYERS];
?
Reply
#7

Thanks it works now, but i don't have any cleu about the second request now!
Reply
#8

Quote:
Originally Posted by WThieves
Thanks it works now, but i don't have any cleu about the second request now!
use
pawn Код:
IsPlayerInRangeOfPoint
and for freezing use

pawn Код:
TogglePlayerControllable(playerid, toggle);//toggle 0 is for freezing and toggle 1 is for unfreezing
Reply
#9

Quote:
Originally Posted by _Saif_
Quote:
Originally Posted by WThieves
Thanks it works now, but i don't have any cleu about the second request now!
use
pawn Код:
IsPlayerInRangeOfPoint
and for freezing use

pawn Код:
TogglePlayerControllable(playerid, toggle);//toggle 0 is for freezing and toggle 1 is for unfreezing
Where do i place this then?
And don't i have to make a new isplayerinrangeofpoint
And for IsPlayerInRangeOfPoint what do i have to put after it
Reply
#10

Bump..
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)