Crap command
#1

Hi all. i made a command for getting info about a player.
pawn Код:
CMD:pinfo(playerid, params [])
{
    if(IsPlayerConnected(playerid))
    {
    if(IsSpecing[playerid] == 1)
    {
    if( isnull ( params ) ) return SendClientMessage(playerid, -1, "Syntax: /pinfo <targetid>");
    if(PlayerInfo[playerid] [pAdmin] < 1) return SendClientMessage(playerid, -1, "Your admin leve isn't high enough to use this command.");
    else
    {
    new string[24+MAX_PLAYER_NAME+1];
    GetPlayerWeapon(playerid);
    SendClientMessage(playerid, -1, "Info about player:");
    new Float:health;
    format(string, sizeof(string), "Health: %.1f",GetPlayerHealth(playerid, health));
    SendClientMessage(playerid, -1,string);
    format(string, sizeof(string), "Weapons:%.1f",GetPlayerWeapon(playerid));
    SendClientMessage(playerid, -1,string);
    new Float:armour;
    format(string, sizeof(string),"Armour: %.1f",GetPlayerArmour(playerid, armour));
    SendClientMessage(playerid, -1,string);
    }
    }
    }
    return 1;
    }
When i type /pinfo it's shows me health 0.00, weapons 0.00 all 0.00 . WHAT?
Reply
#2

pawn Код:
GetPlayerHealth(playerid,health);
   GetPlayerArmour(playerid,armour);
   format(string, sizeof(string), "Health: %.1f",health);
    SendClientMessage(playerid, -1,string);
    format(string, sizeof(string), "Weapons: %i",GetPlayerWeapon(playerid));
    SendClientMessage(playerid, -1,string);
    new Float:armour;
   
    format(string, sizeof(string),"Armour: %.1f",armour);
    SendClientMessage(playerid, -1,string);
Reply
#3

Indent your code, please.
pawn Код:
CMD: pinfo(playerid, params[]) {
    if (IsPlayerConnected(playerid)) {
        if (IsSpecing[playerid] == 1) {
            if (isnull(params)) return SendClientMessage(playerid, -1, "Syntax: /pinfo <targetid>");
            if (PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1, "Your admin leve isn't high enough to use this command.");
            else {
                new Float: pHealth, Float: pArmor;
                new string[24 + MAX_PLAYER_NAME + 1];
                GetPlayerHealth(playerid, pHealth);
                GetPlayerHealth(playerid, pWeapon);
                SendClientMessage(playerid, -1, "Info about player:");
                format(string, sizeof(string), "Health: %.1f", pHealth);
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Current Weapon ID: %d", GetPlayerWeapon(playerid));
                SendClientMessage(playerid, -1, string);
                format(string, sizeof(string), "Armour: %.1f", pArmour);
                SendClientMessage(playerid, -1, string);
            }
        }
    }
    return 1;
}
Reply
#4

Shit man thx a lot. REP
Already i fix that. thx printer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)