No Eerror Just BUG [+REP]
#1

PHP код:
CMD:client(playeridparams[])
{
    if(
pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playeridCOLOR_GREY"You are not allowed to do this");
        new 
AdminDutyMsg[128], targetid;
        
format(AdminDutyMsgsizeof(AdminDutyMsg), ""COL_WHITE"["COL_CADMIN"ADMIN"COL_WHITE"]"COL_CGREY" %s > client > %s" ,PlayerName(playerid), PlayerName(targetid));
        
SendMessageToAllAduty(-1,AdminDutyMsg);
        new 
ammoweaponidweapon[24], string[128],string1[128],string2[128], id,count;
        if( 
sscanf(params"u"id)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /cw [ID]");
        for (new 
013c++)
        {
                
GetPlayerWeaponData(idcweaponidammo);
                if (
weaponid == && ammo == 0) continue;
                
count++;
        }
        if(
count==0) return SendClientMessage(playeridCOLOR_GREY"This player has no weapons!");
        
format(stringsizeof(string), "Players:%s(%d)\nDatabase ID:%d\nWeapons:",PlayerName(targetid),targetid,pInfo[playerid][ID]);
        for (new 
013c++)
        {
                
GetPlayerWeaponData(idcweaponidammo);
                if (
weaponid == && ammo == 0) continue;
                
GetWeaponName(weaponidweapon24);
                
format(string1sizeof(string1), "%s %s(%d)\n"stringweaponammo);
        }
        
format(string2sizeof(string2), "%s \n VirtualWorld:%d    Interior:%d",string1,GetPlayerVirtualWorld(targetid),GetPlayerInterior(targetid));
        return 
ShowPlayerDialog(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"Viewing Client Info",string2,"Close","");

Hello this is my script
I dont have erors just an little bug
He show mee just 1 Weapon and if i have 2 or 3 or 4
He show mee just the first weapon
I want all weapons
Thank you +REP FOR YOU
Reply
#2

Change :
PHP код:
  format(string2sizeof(string2), "%s \n VirtualWorld:%d    Interior:%d",string1,GetPlayerVirtualWorld(targetid),GetPlayerInterior(targetid)); 
By :
PHP код:
  format(string2sizeof(string2), "%s%s \n VirtualWorld:%d    Interior:%d",string2,string1,GetPlayerVirtualWorld(targetid),GetPlayerInterior(targetid)); 
Reply
#3

Not working Again dont show mee all guns
Reply
#4

Hello buddy, i made an example for you to understand;


pawn Код:
CMD:showplayerguns(playerid,params[])
{
    new id,string[128],ammo[2],name[24];
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /showplayerguns [Player Name/Player ID]");
    for(new w = 0; w < 13; w++)
    {
    GetPlayerWeaponData(id, w, ammo[0], ammo[1]);
    if(ammo[0] == 0) continue;
    GetWeaponName(ammo[0], name, sizeof(name));
    format(string, sizeof(string), "Player's Weapons: %s %s(%d),", string, name, ammo[1]);
    }
    string[strlen(string)-1] = 0;
    SendClientMessage(playerid, -1, string);
    return 1;
}
Reply
#5

Thank you both fixed
i have another problem
I want to show health 100.00000 Not just 100
Thank you
Reply
#6

Can you show me where you check the health?
Can't find it in your script.

Anyway, if you see HP 100 instead of 100.0 means that the variable is integer's type, switch it to Float.

Example:

new FloatlayerHealth;
GetPlayerHealth(playerid,playerHealth);

printf("%f",playerHealth);
Reply
#7

I am using %d and it show mee 100 but I want it 100.000000
Reply
#8

To print float data use %f instead of %d/%i.
Reply
#9

Not work it tell mee just 100 i want it 100.000000
Reply
#10

Hello!

PHP код:
new Float:health;
GetPlayerHealth(playerid,health);
printf("%f",float(health)); 
Work this?
Reply


Forum Jump:


Users browsing this thread: