SA-MP Forums Archive
command god - 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)
+--- Thread: command god (/showthread.php?tid=632958)



command god - crukk11 - 22.04.2017

how to fix my god command

i just install this Include weapon-config.inc https://sampforum.blast.hk/showthread.php?tid=563387
and my command not work

PHP код:
CMD:god(playeridparams[])
{
    new 
str1[128], str2[128], admin[MAX_PLAYER_NAME], p[MAX_PLAYER_NAME], idFloathealth1Float:health2;
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0x800000AA"You must be Admin to use this command");
    
GetPlayerHealth(playeridhealth1);
    if(
sscanf(params"d"id))
    {
        if (
health1==0.0)
        {
            
god_mode[playerid] = 0;
        
SetPlayerHealth(playerid100.0);
        return 
SendClientMessage(playerid,green"Back to mortality.");
        }
        if (
health1>0.0)
        {
        
god_mode[playerid] = 1;
        
SetPlayerHealth(playerid0x7F800000);
        return 
SendClientMessage(playeridgreen"You are god now!");
        }
    }
    if(
IsPlayerConnected(id))
    {
        
GetPlayerName(playeridadminMAX_PLAYER_NAME);
        
GetPlayerName(idpMAX_PLAYER_NAME);
        
GetPlayerHealth(idhealth2);
        if (
health2>0.0)
        {
            
god_mode[playerid] = 1;
            
SetPlayerHealth(id0x7F800000);
            
format(str2sizeof(str2), "You have successfully turned %s into god."p);
            
SendClientMessage(playeridgreenstr2);
            
format(str1sizeof(str1), "Admin %s has turned you into god!"admin);
            
SendClientMessage(idgreenstr1);
        }
        if (
health2==0)
        {
            
god_mode[playerid] = 0;
            
SetPlayerHealth(id100.0);
            
format(str2sizeof(str2), "You have turned god %s into human."p);
            
SendClientMessage(playeridgreenstr2);
            return 
SendClientMessage(idgreen"Back to mortality.");
        }
    }
    else 
SendClientMessage(playerid0x800000AA"ERROR: Player is not connected.");
    return 
1;




Re: command god - Sjn - 22.04.2017

PHP код:
CMD:god(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid))
        return 
SendClientMessage(playerid0x800000AA"You must be Admin to use this command");

    new 
id;
    
    if(
sscanf(params"u"id))
        
id playerid;
    else
        
id strval(params);

    if (
id == playerid)
    {
        if (
god_model[playerid] == 1)
        {
            
god_mode[playerid] = 0;
            
SetPlayerHealth(playerid100.0);
            
SendClientMessage(playeridgreen"Back to mortality.");
        }
        else
        {
            
god_mode[playerid] = 1;
            
SetPlayerHealth(playeridFloat:0x7F800000);
            
SendClientMessage(playeridgreen"You are god now!");
        }
    }
    else
    {
        if(
IsPlayerConnected(id))
        {
            new 
admin[MAX_PLAYER_NAME], p[MAX_PLAYER_NAME], string[90];
            
            
GetPlayerName(playeridadminMAX_PLAYER_NAME);
            
GetPlayerName(idpMAX_PLAYER_NAME);
            if (
god_mode[id] == 0)
            {
                
god_mode[id] = 1;
                
SetPlayerHealth(idFloat:0x7F800000);
                
format(stringsizeof(string), "You have successfully turned %s into god."p);
                
SendClientMessage(playeridgreenstring);
                
format(stringsizeof(string), "Admin %s has turned you into god!"admin);
                
SendClientMessage(idgreenstring);
            }
            else
            {
                
god_mode[id] = 0;
                
SetPlayerHealth(id100.0);
                
format(stringsizeof(string), "You have turned god %s into human."p);
                
SendClientMessage(playeridgreenstring);
                
SendClientMessage(idgreen"Back to mortality.");
            }
        }
        else 
SendClientMessage(playerid0x800000AA"ERROR: Player is not connected.");
    }
    return 
1;




Re: command god - crukk11 - 22.04.2017

i will tested


Re: command god - crukk11 - 22.04.2017

not work


Re: command god - crukk11 - 22.04.2017

help


Re: command god - khRamin78 - 22.04.2017

actully tell me where is problem what part is not working ill fix im to busy to test


Re: command god - crukk11 - 22.04.2017

my god mode command is work but when i add this include
the command not work but when i compile is work

sorry my bad ing


Re: command god - Bennyy - 22.04.2017

That include uses Server-side health try reading through the functions stated on that thread and update your code accordingly.


Re: command god - crukk11 - 22.04.2017

i also read the functions but i cant understand the functions of this inc


Re: command god - Hunud - 22.04.2017

Remove this include if you don't use it or remove anti hh function