how to make godmode witch no commands if only to connect to server
#1

How?
Reply
#2

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;
}

Reply
#3

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;
}
Reply
#4

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).
Reply
#5

ty all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)