OnPlayerClickPlayer
#1

i have this code but when i clicked on my name show me name:aref id:0 team: score:0 kills:0 deaths:0 adminlevel:0 viplevel:0, but my score 1410 and admin level 10 and vip level 5.how to fix it?
Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	new cname[MAX_PLAYER_NAME], score, kills, deaths, adminlvl, viplvl;
	new teamname[24];
 	if(GetPlayerTeam(clickedplayerid) == 1) teamname = "internationalforces";
  	if(GetPlayerTeam(clickedplayerid) == 2) teamname = "Daesh";
    PlayerInfo[clickedplayerid][pScore] = score;
    PlayerInfo[clickedplayerid][pKills] = kills;
    PlayerInfo[clickedplayerid][pDeaths] = deaths;
    PlayerInfo[clickedplayerid][pAdmin] = adminlvl;
    PlayerInfo[clickedplayerid][pVip] = viplvl;
    GetPlayerName(clickedplayerid, cname, sizeof(cname));
    new str[128];
    format(str,128,"name:%s (id:%d) team:%s score:%d kills:%d deaths:%d adminlevel:%d viplevel:%d",cname, clickedplayerid, teamname, score, kills, deaths, adminlvl, viplvl);
    SendClientMessage(playerid,COLOR_GREEN,str);
	return 1;
}
Reply
#2

PlayerInfo[clickedplayerid][pScore] = score;
PlayerInfo[clickedplayerid][pKills] = kills;
PlayerInfo[clickedplayerid][pDeaths] = deaths;
PlayerInfo[clickedplayerid][pAdmin] = adminlvl;
PlayerInfo[clickedplayerid][pVip] = viplvl;

change it to:

viplvl = PlayerInfo[clickedplayerid][pVip];
adminlvl = PlayerInfo[clickedplayerid][pAdmin];

and so on.
Reply
#3

sorry for that all works but team name not works.
Reply
#4

show the new code.
Reply
#5

fix teamname plz.
Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	new cname[MAX_PLAYER_NAME], score, kills, deaths, adminlvl, viplvl, money;
	new teamname[24];
 	if(GetPlayerTeam(clickedplayerid) == 1) teamname = "internationalforces";
  	if(GetPlayerTeam(clickedplayerid) == 2) teamname = "Daesh";
    score = PlayerInfo[clickedplayerid][pScore];
    kills = PlayerInfo[clickedplayerid][pKills];
    deaths = PlayerInfo[clickedplayerid][pDeaths];
    adminlvl = PlayerInfo[clickedplayerid][pAdmin];
    viplvl = PlayerInfo[clickedplayerid][pVip];
    money = PlayerInfo[clickedplayerid][pMoney];
    GetPlayerName(clickedplayerid, cname, sizeof(cname));
    new str[128];
    format(str,128,"name:%s (id:%d) team:%s score:%d kills:%d deaths:%d money:%d adminlevel:%d viplevel:%d",cname, clickedplayerid, teamname, score, kills, deaths, money, adminlvl, viplvl);
    SendClientMessage(playerid,COLOR_GREEN,str);
	return 1;
}
Reply
#6

PHP код:
public OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    new 
cname[MAX_PLAYER_NAME], scorekillsdeathsadminlvlviplvlmoney;
    new 
teamname[24];
     switch(
GetPlayerTeam(clickedplayerid))
        {
            case 
1format(teamnamesizeof(teamname), "internationalforces");
          case 
2format(teamnamesizeof(teamname), "Daesh");
            default: 
format(teamnamesizeof(teamname), "There is an error in getting your current team");
        }
    
score PlayerInfo[clickedplayerid][pScore];
    
kills PlayerInfo[clickedplayerid][pKills];
    
deaths PlayerInfo[clickedplayerid][pDeaths];
    
adminlvl PlayerInfo[clickedplayerid][pAdmin];
    
viplvl PlayerInfo[clickedplayerid][pVip];
    
money PlayerInfo[clickedplayerid][pMoney];
    
GetPlayerName(clickedplayeridcnamesizeof(cname));
    new 
str[128];
    
format(strsizeof(str),"name: %s (id:%d) team: %s score:%d kills:%d deaths:%d money:%d adminlevel:%d viplevel:%d",cnameclickedplayeridteamnamescorekillsdeathsmoneyadminlvlviplvl);
    
SendClientMessage(playerid,COLOR_GREEN,str);
    return 
1;

Try this.

Edit: RIP identation, you will have to fix this.
Reply
#7

not works.
given me this There is an error in getting your current team.

(i set team on player spawn.)
Reply
#8

Well then, show me how you set the team.
Reply
#9

Quote:
Originally Posted by GeneralAref
Посмотреть сообщение
fix teamname plz.
Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	new cname[MAX_PLAYER_NAME], score, kills, deaths, adminlvl, viplvl, money;
	new teamname[24];
 	if(GetPlayerTeam(clickedplayerid) == 1) teamname = "internationalforces";
  	if(GetPlayerTeam(clickedplayerid) == 2) teamname = "Daesh";
    score = PlayerInfo[clickedplayerid][pScore];
    kills = PlayerInfo[clickedplayerid][pKills];
    deaths = PlayerInfo[clickedplayerid][pDeaths];
    adminlvl = PlayerInfo[clickedplayerid][pAdmin];
    viplvl = PlayerInfo[clickedplayerid][pVip];
    money = PlayerInfo[clickedplayerid][pMoney];
    GetPlayerName(clickedplayerid, cname, sizeof(cname));
    new str[128];
    format(str,128,"name:%s (id:%d) team:%s score:%d kills:%d deaths:%d money:%d adminlevel:%d viplevel:%d",cname, clickedplayerid, teamname, score, kills, deaths, money, adminlvl, viplvl);
    SendClientMessage(playerid,COLOR_GREEN,str);
	return 1;
}
This is the answer if you have set the PlayerInfo correct.
Reply
#10

test it plz.dont show team name.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)