At the top of your script:
pawn Код:
new clickedplayer[MAX_PLAYERS]; //At the top of your script
OnPlayerConnect:
pawn Код:
clickedplayer[playerid] = INVALID_PLAYER_ID;
PlayerData[playerid][RepTime] = 0;
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(clickedplayerid != INVALID_PLAYER_ID)
{
new fstr[55], name[MAX_PLAYER_NAME];
GetPlayerName(clickedplayerid, name, sizeof(name));
format(fstr, sizeof(fstr), "Give reputation to %s(%d)?", name, clickedplayerid);
clickedplayer[playerid] = clickedplayerid;
ShowPlayerDialog(playerid, 200, DIALOG_STYLE_MSGBOX, "Reputation", fstr, "+REP", "Exit");
}
return 1;
}
OnDialogResponse:
pawn Код:
if(dialogid == 200)
{
if(response)
{
if(clickedplayer[playerid] != INVALID_PLAYER_ID)
{
if(clickedplayer[playerid] != playerid)
{
if((gettime() >= PlayerData[playerid][RepTime]) || !PlayerData[playerid][RepTime])
{
new fstr[45], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(fstr, sizeof(fstr), "You got 1 rep from %s", name);
SendClientMessage(clickedplayer[playerid], -1, fstr);
GetPlayerName(clickedplayer[playerid], name, sizeof(name));
format(fstr, sizeof(fstr), "You sent 1 rep to %s", name);
SendClientMessage(playerid, -1, fstr);
PlayerData[clickedplayer[playerid]][Rep] += 1;
PlayerData[playerid][RepTime] = gettime() + 60;
}
else SendClientMessage(playerid, -1, "You must wait 1 minute before giving reputation again.");
}
else SendClientMessage(playerid, -1, "You cannot give yourself reputation.");
}
}
clickedplayer[playerid] = INVALID_PLAYER_ID;
return 1;
}