how to make godmode witch no commands if only to connect to server - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how to make godmode witch no commands if only to connect to server (
/showthread.php?tid=155051)
how to make godmode witch no commands if only to connect to server -
Player63 - 16.06.2010
How?
Re: how to make godmode witch no commands if only to connect to server -
Ihsan_Cingisiz - 16.06.2010
Quote:
|
Originally Posted by Player63
How?
|
Here you go.
Quote:
public OnPlayerConnect(playerid)
{
SetPlayerHealth(playerid, 1000000000);
SetPlayerArmour(playerid, 1000000000);
GivePlayerWeapon(playerid, 38, 1000000000);
SendClientMessage(playerid, 0xFFFFFFFF, "You have spawned with godmode");
}
|
Or if you want to use a variable or something.
Quote:
public OnPlayerConnect(playerid)
{
GodMode[playerid] = 1;
}
|
Re: how to make godmode witch no commands if only to connect to server -
Naxix - 16.06.2010
Eh, you cut make a loop on OnPlayerUpdate and just set every's hp to 100, but i think that would cause lag
or use timers to set every1's hp to 100 all the time.
e.g
new Godmode[MAX_PLAYERS];
OnPlayerConnect
Код:
Godmode[playerid] = SetTimerEx("God",100,1,"playerid",playerid);
Bottom of your script:
Код:
forward God(playerid);
public God(playerid)
{
SetPlayerHealth(playerid,100);
return 1;
}
Re: how to make godmode witch no commands if only to connect to server -
Kyosaur - 16.06.2010
Quote:
|
Originally Posted by Naxix
Eh, you cut make a loop on OnPlayerUpdate and just set every's hp to 100, but i think that would cause lag
or use timers to set every1's hp to 100 all the time.
e.g
new Godmode[MAX_PLAYERS];
OnPlayerConnect
Код:
Godmode[playerid] = SetTimerEx("God",100,1,"playerid",playerid);
Bottom of your script:
Код:
forward God(playerid);
public God(playerid)
{
SetPlayerHealth(playerid,100);
return 1;
}
|
Looping under OnPlayerUpdate is the worst idea ever, not only is it called an absurd amount of times, but it also is not neede cause it has a playerid parameter.
Your timer is also a bad idea provided it used the correct syntax and would work. 100ms for a single SMALL part of a script? Are you insane lol

.
Not only is 100ms WAY to fast, but you would be using 500 of them.
Код:
#define FLOAT_INFINITY (Float:0x7F800000)
That define is, as if you guessed by the name, infinite. So when they connect, set their health or armour to that (set back to 100.0 to disable the god mode).
Re: how to make godmode witch no commands if only to connect to server -
Player63 - 17.06.2010
ty all