/god command problem.
#2

pawn Код:
CMD:god(playerid, params[])
{
    new str[128], admin[MAX_PLAYER_NAME + 1], p[MAX_PLAYER_NAME + 1], id, Float:health;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "You must be Admin to use this command");

    if(sscanf(params, "u", id) || playerid == id) return SetPlayerHealth(playerid, 9999999999999999.0);
   
    GetPlayerName(playerid, admin, MAX_PLAYER_NAME);
    GetPlayerName(id, p, MAX_PLAYER_NAME);
    GetPlayerHealth(id, health);
    if(IsPlayerConnected(id) && health <= 100.0)
    {
        SetPlayerHealth(id, 9999999999999999.0);
        format(str, sizeof(str), "Admin %s has turned you into god!", admin);
        SendClientMessage(id, 0x00FF00AA, str);
        format(str, sizeof(str), "You have successfully turned %s into god.", p);
        return SendClientMessage(playerid, 0x00FF00AA, str);
    }
    else if (IsPlayerConnected(id) && health > 100.0)
    {                                                    
        SetPlayerHealth(id, 100.0);                      
        format(str, sizeof(str), "Back to mortality.");//
        return SendClientMessage(playerid, 0x00FF00AA, str);
    }                                                      
    else return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player is not connected.");
}
Empty statement occurs usually because of stray ";". Don't create so many str variables when all you need is one.
Reply


Messages In This Thread
/god command problem. - by HurtLocker - 11.03.2013, 20:03
Re: /god command problem. - by Misiur - 11.03.2013, 20:17
Re: /god command problem. - by HurtLocker - 11.03.2013, 20:21

Forum Jump:


Users browsing this thread: 1 Guest(s)