command god
#2

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;

Reply


Messages In This Thread
command god - by crukk11 - 22.04.2017, 16:23
Re: command god - by Sjn - 22.04.2017, 16:40
Re: command god - by crukk11 - 22.04.2017, 16:41
Re: command god - by crukk11 - 22.04.2017, 16:46
Re: command god - by crukk11 - 22.04.2017, 17:27
Re: command god - by khRamin78 - 22.04.2017, 17:43
Re: command god - by crukk11 - 22.04.2017, 17:49
Re: command god - by Bennyy - 22.04.2017, 18:14
Re: command god - by crukk11 - 22.04.2017, 18:21
Re: command god - by Hunud - 22.04.2017, 18:31

Forum Jump:


Users browsing this thread: 3 Guest(s)