Put this at the top.
Now do this.
pawn Код:
CMD:sharexp(playerid,params[])
{
if(sharetimer[playerid] == 1) return SendClientMessage(playerid, -1, "You must wait 3 minutes to use this cmd!");//checks if the player used the cmd already.
if(pInfo[playerid][pLogged] == 1)
{
if(pInfo[playerid][pHour] >= 10)
{
new targetid,givexp,reason[105],stringxp[256];
if(sscanf(params,"uis[105]", targetid,givexp,reason)) return SendClientMessage(playerid,-1,""chat" /sharexp [playerid] [amount] [reason]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
if(targetid == playerid) return SendClientMessage(playerid,-1,""chat" You cannot give xp to yourself");
if(givexp < 49 || givexp > 5000) return SendClientMessage(playerid,-1,""chat" You can only give xp between 50-5000");
if (givexp > 0 && pInfo[playerid][pXP] >= givexp)
{
pInfo[targetid][pXP] += givexp;
pInfo[playerid][pXP] -= givexp;
sharetimer[playerid] = 1; // Once you use the command it makes it 1, stating you can not use it again, until the timer ends
sharexptimer[playerid] = SetTimerEx("XP", 200000,false, "d", playerid); //starts the timer
format(stringxp,sizeof(stringxp),""chat" Player %s has shared %d xp to %s [Reason: %s]", PlayerName(playerid), givexp, PlayerName(targetid), reason);
SendClientMessageToAll(-1,stringxp);
printf("Player %s has shared %d xp to %s [Reason: %s]", PlayerName(playerid), givexp, PlayerName(targetid), reason);
}
else
{
SendClientMessage(playerid,-1,""chat" You don't have enough XP");
}
}
else SendClientMessage(playerid,-1,""chat" You need to play 10 hours before you can share xp!");
}
else if(pInfo[playerid][pLogged] == 0)
{
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" Nice try u fucking fag gay!");
printf("%s has been kicked for trying to use a command without being logged in!", PlayerName(playerid));
Kick(playerid);
}
return 1;
}
pawn Код:
forward XP(playerid);
public XP(playerid)
{
sharetimer[playerid] = 0;//lets you use the cmd again once the timer has ended
SendClientMessage(playerid, -1, "You can use share XP again");
return 1;
}