/info command problem
#1

Hello,i've this command for admins to show the selected player stats in a dialog:

pawn Код:
CMD:info(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 1)
    {
    new giveplayerid;
    new Float:gihp, Float:giar;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(giveplayerid, name, sizeof(name));
    GetPlayerHealth(giveplayerid, gihp);
    GetPlayerArmour(giveplayerid, giar);
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /info [ID/PartOfName]");
    if(IsPlayerConnected(giveplayerid))
    {
        new temp[128];
        new info[128];
        format(info, sizeof(info), "{0FA0D1}Name: %s\n",name);
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}Cash: %i$\n",GetPlayerMoney(playerid));
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}Wanted Level: %d\n",PlayerInfo[playerid][pWantedLevel]);
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}Admin Level: %s\n",PlayerInfo[playerid][pAdmin]);
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}Kills: %i\n",PlayerInfo[playerid][pKills]);
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}Deaths: %i\n",PlayerInfo[playerid][pDeaths]);
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}Health: %0.1f\n",gihp);
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}Armour: %0.1f\n",giar);
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}VIP: %d (1 = YES - 0 = NO)\n",PlayerInfo[playerid][pVip]);
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}Score: %i\n",GetPlayerScore(playerid));
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}Condoms: %d\n",PlayerInfo[playerid][pCondoms]);
        strcat(info, temp);
       
        format(info, sizeof(info), "{0FA0D1}Life Insurance: %d (1 = YES - 0 = NO)\n",PlayerInfo[playerid][pLifeIns]);
        strcat(info, temp);
        ShowPlayerDialog(playerid, 17, DIALOG_STYLE_MSGBOX,"{53C506}Player Info",info,"Close","");
    }
    else
    {
        SendClientMessage(playerid, red, "Invalid player specified.");
    }
    return true;
    }
    else return 0;
}
I don't get any errors when i compile it,but ingame,if i use it,only the "Life Insurance" box stats is showing,what's wrong?

I need to show them all.
Reply
#2

You stored 'info' into 'temp'. Show them the dialog 'temp'. Not to mention, you need to increase the cell size of your strings.
Reply
#3

pawn Код:
CMD:info(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 1)
    {
    new giveplayerid;
    new Float:gihp, Float:giar;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(giveplayerid, name, sizeof(name));
    GetPlayerHealth(giveplayerid, gihp);
    GetPlayerArmour(giveplayerid, giar);
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /info [ID/PartOfName]");
    if(IsPlayerConnected(giveplayerid))
    {
        new temp[128];
        new info[256];
        format(temp, sizeof(temp), "{0FA0D1}Name: %s\n",name);
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}Cash: %i$\n",GetPlayerMoney(playerid));
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}Wanted Level: %d\n",PlayerInfo[playerid][pWantedLevel]);
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}Admin Level: %s\n",PlayerInfo[playerid][pAdmin]);
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}Kills: %i\n",PlayerInfo[playerid][pKills]);
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}Deaths: %i\n",PlayerInfo[playerid][pDeaths]);
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}Health: %0.1f\n",gihp);
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}Armour: %0.1f\n",giar);
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}VIP: %d (1 = YES - 0 = NO)\n",PlayerInfo[playerid][pVip]);
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}Score: %i\n",GetPlayerScore(playerid));
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}Condoms: %d\n",PlayerInfo[playerid][pCondoms]);
        strcat(info, temp);
       
        format(temp, sizeof(temp), "{0FA0D1}Life Insurance: %d (1 = YES - 0 = NO)\n",PlayerInfo[playerid][pLifeIns]);
        strcat(info, temp);
        ShowPlayerDialog(playerid, 17, DIALOG_STYLE_MSGBOX,"{53C506}Player Info",info,"Close","");
    }
    else
    {
        SendClientMessage(playerid, red, "Invalid player specified.");
    }
    return true;
    }
    else return 0;
}
Reply
#4

hey also you miss the part on Score and Cash , youre talking about (playerid) that will show your cash and score not the (giveplayerid)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)