Client CmD
#5

Quote:
Originally Posted by Konstantinos
View Post
Never use ShowPlayerDialog in a loop as it'll be called way too many times and also no need to loop twice:
PHP Code:
for (new 013c++)
{
    
GetPlayerWeaponData(idcweaponidammo);
    if (
weaponid != && ammo != 0)
    {
        
GetWeaponName(weaponidweapon24);
        
format(stringsizeof(string), "%sWeapons: %s  Ammo: %d\n"stringweaponammo);
        
count++;
    }
}
if(!
countSendClientMessage(playeridCOLOR_GREY"This player has no weapons!");
else 
ShowPlayerDialog(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"Client",string,"Close","");
return 
1
PS: You declared "targetid" and you are trying to get the name. It has not been assigned to any value so it will always return the name of the player with ID 0.
Thanks What about here now
I want to get name just one time not 2 times and the name
I get 2 times the name or if i have 3 weapons i get the name 3 times
What i must do ? THanks for help TOoo

PHP Code:
CMD:client(playeridparams[])
{
    if(
pInfo[playerid][pAdminLevel] >= 1)
    {
        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 
count 0;
        new 
ammoweaponidweapon[24], string[128], id;
        if(!
sscanf(params"u"id))
        {
                for (new 
013c++)
                {
                    
GetPlayerWeaponData(idcweaponidammo);
                    if (
weaponid != && ammo != 0)
                    {
                        
count++;
                    }
                }
                if(
count 0)
                {
                    for (new 
013c++)
                    {
                        
GetPlayerWeaponData(idcweaponidammo);
                        if (
weaponid != && ammo != 0)
                        {
                            
GetWeaponName(weaponidweapon24);
                            
format(stringsizeof(string), "Players:%s(%d)\n  %sWeapons: %s(%d)\n",PlayerName(targetid),targetidstringweaponammo);
                            
ShowPlayerDialog(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"Viewing Client Info",string,"Close","");
                        }
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"This player has no weapons!");
                }
                return 
1;
        }
        else return 
SendClientMessage(playeridCOLOR_GREY"USAGE: /cw [ID]");
    }
    else return 
SendClientMessage(playeridCOLOR_GREY"You are not allowed to do this");

Reply


Messages In This Thread
Client CmD - by arlindi - 29.04.2015, 20:30
Re: Client CmD [+REP] - by zeax - 29.04.2015, 20:36
Re: Client CmD - by arlindi - 29.04.2015, 20:39
Re: Client CmD - by Konstantinos - 29.04.2015, 20:39
Re: Client CmD - by arlindi - 29.04.2015, 20:46
Re: Client CmD - by arlindi - 29.04.2015, 21:11
Re: Client CmD - by arlindi - 30.04.2015, 11:28
Re: Client CmD - by arlindi - 30.04.2015, 17:36

Forum Jump:


Users browsing this thread: 1 Guest(s)