SA-MP Forums Archive
OnPlayerClickPlayer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerClickPlayer (/showthread.php?tid=596645)



OnPlayerClickPlayer - GeneralAref - 20.12.2015

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;
}



Re: OnPlayerClickPlayer - thefirestate - 20.12.2015

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.


Re: OnPlayerClickPlayer - GeneralAref - 20.12.2015

sorry for that all works but team name not works.


Re: OnPlayerClickPlayer - thefirestate - 20.12.2015

show the new code.


Re: OnPlayerClickPlayer - GeneralAref - 20.12.2015

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;
}



Re: OnPlayerClickPlayer - thefirestate - 20.12.2015

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.


Re: OnPlayerClickPlayer - GeneralAref - 20.12.2015

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

(i set team on player spawn.)


Re: OnPlayerClickPlayer - thefirestate - 20.12.2015

Well then, show me how you set the team.


Re: OnPlayerClickPlayer - Mic_H - 21.12.2015

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.


Re: OnPlayerClickPlayer - GeneralAref - 21.12.2015

test it plz.dont show team name.