08.09.2012, 21:18
How to I add +1 in my code below, If I do /rep to a player? I'm using Luxadmin and it save as using #include <ldudb>
This is what I converted.
Newbienoob code. using Y_INI
This is what I converted.
pawn Код:
dcmd_rep(playerid,params[])
{
new repID, repName[MAX_PLAYER_NAME],name[24],str[128],str1[128];
if(reptimer[playerid] > 0) return SendClientMessage(playerid, white,"{FF0000}You have already gave someone a rep. Please wait before using it again");
if(sscanf(params,"u",repID)) return SendClientMessage(playerid, white,"{FFFF00}USAGE: /rep [PlayerID]");
if(!IsPlayerConnected(repID)) return SendClientMessage(playerid, white,"{FF0000}>>Player is not online");
if(repID == playerid) return SendClientMessage(playerid, white,"{FF0000}>> You can't give yourself a reputation");
reptimer[playerid] = SetTimerEx("reptimer1",1200000,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;
}
pawn Код:
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;
}