29.08.2012, 18:35
So If do /rep [playerid] [amount] to a player.
Then when he do /stats it must be shown something like this below.
Kills:24
Deaths:872
Reputation: 4
I have already added under enum playerdata
No warning after compiling then I do /stats in game I don't see Reputation:
Then when he do /stats it must be shown something like this below.
Kills:24
Deaths:872
Reputation: 4
I have already added under enum playerdata
Код:
Under Register dUserSetINT(PlayerName2(playerid)).("Rep",0); dUserSetINT(PlayerName2(playerid)).("Rep",0); Under dcmd_stats format(str, sizeof(str), "%Reputation: %d\n", str, AcciIfo(player1)); Under LoginPlayer (dUserINT(PlayerName2(playerid)).("Rep")); Under SavePlayerStats dUserSetINT(PlayerName2(playerid)).("Rep",AccInfo[playerid][Rep]);
pawn Код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
new pRep[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
pRep[playerid] = 0;
return 1;
}
dcmd:rep(playerid,params[])
{
new rep,target,pName[MAX_PLAYER_NAME],string1[124],string[124],pTarget[MAX_PLAYER_NAME];
if(sscanf(params,"ui",target,rep)) return SendClientMessage(playerid,-1,"/rep [playerid] [reputation]");
new oldrep = pRep[target];
pRep[target] = oldrep+rep;
GetPlayerName(target,pTarget,MAX_PLAYER_NAME);
format(string,sizeof(string),"You gave %s(ID:%d) +%d reputation!",pTarget,target,rep);
SendClientMessage(playerid,-1,string);
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string1,sizeof(string1),"%s,(ID:%d) has gave you +%d reputation.",pName,playerid,rep);
SendClientMessage(target,-1,string1);
return 1;
}