08.09.2012, 15:57
Is this possible to Combine this to Luxadmin System?
If I do /stats Reputation should be there.
Example..
Credits to Newbienoob for the filterscript.
If I do /stats Reputation should be there.
Example..
Код:
ID: 41 Skin: 32 Reputation: 6 Wanted Level: 0 Virtual World: 0 //so on
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <YSI\y_ini>
new reptimer[MAX_PLAYERS];
#define reppath "Users/Reps/%s.ini"
#define red 0xFF0000C8
#define green 0x00FF00C8
#define yellow 0xFFFF00C8
enum playerInfo{Reps};
new pInfo[MAX_PLAYERS][playerInfo];
forward loadreps(playerid, name[], value[]);
public loadreps(playerid, name[], value[])
{
new INI:file = INI_Open(repPath(playerid));
INI_Int("Reputations",pInfo[playerid][Reps]);
INI_Close(file);
return 1;
}
stock repPath(playerid)
{
new str[128],name[24];
GetPlayerName(playerid,name,24);
format(str,sizeof(str),reppath,name);
return str;
}
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Rep system by newbienoob has loaded");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
CMD:rep(playerid,params[])
{
new repID, repName[MAX_PLAYER_NAME],name[24],str[128],str1[128];
if(reptimer[playerid] > 0) return SendClientMessage(playerid,red,"You have already gave someone a rep. Please wait before using it again.");
if(sscanf(params,"u",repID)) return SendClientMessage(playerid,red,"USAGE: /rep [playerid]");
if(!IsPlayerConnected(repID)) return SendClientMessage(playerid,red,"Player is not online!");
if(repID == playerid) return SendClientMessage(playerid,red,"You can't give yourself a rep!");
new INI:file = INI_Open(repPath(repID));
INI_SetTag(file,"Reps");
INI_WriteInt(file,"Reputations",pInfo[repID][Reps]+1);
INI_Close(file);
pInfo[repID][Reps]++;
reptimer[playerid] = SetTimerEx("reptimer1",900000,true,"i",playerid);
GetPlayerName(playerid,name,24);
GetPlayerName(repID,repName,sizeof(repName));
format(str,sizeof(str),"%s(%d) has gave 1 reputation point to you.",name,playerid);
SendClientMessage(repID,green,str);
format(str1,sizeof(str1),"You have gave %s(%d) 1 reputation point.",repName,repID);
SendClientMessage(playerid,green,str1);
return 1;
}
CMD:myreps(playerid,params[])
{
new str[128];
format(str,sizeof(str),"Your reputation point(s): %d",pInfo[playerid][Reps]);
SendClientMessage(playerid,green,str);
return 1;
}
forward reptimer1(playerid);
public reptimer1(playerid)
{
SendClientMessage(playerid,yellow,"You can now give someone a reputation point");
reptimer[playerid] = 0;
return 1;
}
public OnPlayerConnect(playerid)
{
INI_ParseFile(repPath(playerid),"loadreps",.bExtra = true, .extra = playerid);
return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
return 1;
}
#endif