Server Stop when using /god
#1

Hello guys,
i have a Problem with my /god command ,i bet you know what does that command do so i wont be telling.
the problem is that when i use it the server stops and i need to go to the cpanel and start it.

here's the pawn code of /god

pawn Код:
#define INFINITY                (Float:0x7F800000)
new GodMode[MAX_PLAYERS];

and then OnPlayerCommandText
pawn Код:
CMD:god(playerid, params[])
{
    if(GodMode[playerid] == 0)
    {
        SetPlayerHealth(playerid, INFINITY);
        GodMode[playerid] = 1;
        SendClientMessage(playerid, 0x10F441AA, "You have Enabled your God Mode.");
        SendClientMessageToAll(-1, "%s has Disabled his/her GodMode.");
    }
    else if(GodMode[playerid] == 1)
    {
        SetPlayerHealth(playerid, 100.0);
        GodMode[playerid] = 0;
        SendClientMessage(playerid, 0x10F441AA, "You have Dissabled your God Mode.");
        SendClientMessageToAll(-1, "%s has Disabled his/her GodMode.");
        }
    return 1;
}
Reply
#2

Remove that INFINITY and repalce it with 65535. Oh and it says has "Disabled" his/her GodMode in both cases the first one should be "Enabled".
Reply
#3

Remplace this

#define INFINITY (9999.0)
Reply
#4

Like that ?
pawn Код:
#define 65535                (Float:0x7F800000)
new GodMode[MAX_PLAYERS];
pawn Код:
CMD:god(playerid, params[])
{
    if(GodMode[playerid] == 0)
    {
        SetPlayerHealth(playerid, 65535);
        GodMode[playerid] = 1;
        SendClientMessage(playerid, 0x10F441AA, "You have Enabled your God Mode.");
        SendClientMessageToAll(-1, "%s has Enabled his/her GodMode.");
    }
    else if(GodMode[playerid] == 1)
    {
        SetPlayerHealth(playerid, 100.0);
        GodMode[playerid] = 0;
        SendClientMessage(playerid, 0x10F441AA, "You have Dissabled your God Mode.");
        SendClientMessageToAll(-1, "%s has Disabled his/her GodMode.");
        }
    return 1;
}
and thank you for the enabled thing didnt see it :P
Reply
#5

U donґt need define 65535, its the health..
Reply
#6

with the 65535 it says:

C:\Users\Andre\Desktop\Samp Script\.pwn , .amx\SSW_Test_Gamemode.pwn(6) : error 074: #define pattern must start with an alphabetic character

and with :
#define INFINITY (9999.0)
it still make the server stop
Reply
#7

try this
pawn Код:
#define INFINITY (Float:0x7F800000)
Reply
#8

pawn Код:
CMD:god(playerid, params[])
{
    if(GodMode[playerid] == 0)
    {
        GodMode[playerid] = 1;
        SetPlayerHealth(playerid, 9999999);
        SendClientMessage(playerid, 0x10F441AA, "You have Enabled your God Mode.");
        SendClientMessageToAll(-1, "%s has Disabled his/her GodMode.");
        return 1;
    }
    GodMode[playerid] = 0;
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, 0x10F441AA, "You have Dissabled your God Mode.");
    SendClientMessageToAll(-1, "%s has Disabled his/her GodMode.");
    return 1;
}
Reply
#9

I told you to remove the whole define thing the command should be just
Код:
CMD:god(playerid, params[])
{
    if(GodMode[playerid] == 0)
    {
        GodMode[playerid] = 1;
        SetPlayerHealth(playerid, 65535);
        SendClientMessage(playerid, 0x10F441AA, "You have Enabled your God Mode.");
        SendClientMessageToAll(-1, "%s has Disabled his/her GodMode.");
        return 1;
    }
    GodMode[playerid] = 0;
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, 0x10F441AA, "You have Dissabled your God Mode.");
    SendClientMessageToAll(-1, "%s has Disabled his/her GodMode.");
    return 1;
}
Reply
#10

I will suggest you to download rSI. This include will make scripting easier for you, I guess.
Go through the "r_health" section.

Click Here.

If you already have rSI included.
pawn Код:
#include <rSI\r_health>

CMD:god(playerid, params[])
{
    if(GodMode[playerid] == 0)
    {
        EnableGod(playerid); //rSI Function. "r_health"
        GodMode[playerid] = 1;
        SendClientMessage(playerid, 0x10F441AA, "You have Enabled your God Mode.");
        SendClientMessageToAll(-1, "%s has Disabled his/her GodMode.");
    }
    else if(GodMode[playerid] == 1)
    {
        DisableGod(playerid); //rSI function. "r_health
        GodMode[playerid] = 0;
        SendClientMessage(playerid, 0x10F441AA, "You have Dissabled your God Mode.");
        SendClientMessageToAll(-1, "%s has Disabled his/her GodMode.");
        }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)