Auto Godmode
Hi!
So i tried to make a plugin that gives every player godmode when they spawn, i came up with this piece of code:
#include
#include
#include
#define PLUGIN "Auto Godmode"
#define AUTHOR "Phenom"
#define VERSION "1.0"
new amx_autogodmode
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
amx_autogodmode = register_cvar("amx_autogodmode", "1")
RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1)
}
public PlayerSpawn(id)
{
new maxPlayers = get_maxplayers();
for (new i=0; i
if (is_user_alive(i))
{
if(get_pcvar_num(amx_autogodmode ==1) && get_user_godmode(i) == 0)
{
set_user_godmode(i,1)
client_print(i, print_chat, "[Auto Godmode] You now got godmode")
}
}
} It compiles just fine and it runs on the server but it ain't giving anyone godmode nor showing the message it's suppose to do.. Please tell me what's wrong // Phenom
your spawn function should be like this
public PlayerSpawn(id) {
if(get_pcvar_num(amx_autogodmode == 1) && get_user_godmode(i) == 0) {
set_user_godmode(id, 1);
client_print(id, print_chat, "[Auto Godmode] Now you have godmode.");
}
}xPaw it still don't works .. :S
Im confused, please help!
1) look at "get_pcvar_num(amx_autogodmode == 1)" it returns wrong data :) should be "get_pcvar_num(amx_autogodmode) == 1"
2) correct for statement should be "for( i = 1; i <= maxplayers; i++ )" coz (i = 0) - worldspawn, so in your plugin latest player never get godmode theoretically (never test it and never test that for for described thing, but in all plugins i c used that for statement that deal with players)
Thnx for tip Lt.RAT, maybe my plugin will run thanks to you to guys :D
rat was faster than me :(
Well thanx anyways SchlumPF, happy you wanted to help me :D
Please log in to post replies.