How to give reputation?
#1

Hello how to give reputation on clickedplayerid?

Код:
else if(dialogid == 200)
    {
        if(response)
        {

        }
        if(!response)
        {
            if(PlayerData[playerid][RepTime] > 1)
            {
                SendClientMessage(playerid, COLOR_RED, "1 reputation every 1 minute");
            }
            else
            {
                
            }
        }
        return 1;
    }
Reply
#2

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Click for details !
Reply
#3

Im want if clicked on player show info and two buttons: +REP and Exit

This code i have:

Код:
ShowPlayerDialog        ( playerid, 200, DIALOG_STYLE_MSGBOX, "{FFFFFF}Info", msg, "+REP", "Exit" );
But im created rep system i bugged:

Код:
else if(dialogid == 200)
    {
        if(!response)
        {

        }
        if(response)
        {
            new targetid;
            if( targetid == playerid ) return SendClientMessage( playerid, COLOR_RED, "you can not give yourself" );
            if(PlayerData[playerid][RepTime] > 1)
            {
                SendClientMessage(playerid, COLOR_RED, "1 reputation every 1 minute ");
            }
            else
            {
                
                new z[128];
                new x[128];
                new name[MAX_PLAYER_NAME];
                new targetname[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, MAX_PLAYER_NAME);
                GetPlayerName(playerid, targetname, MAX_PLAYER_NAME);
                format(z, sizeof(z), "yOU got 1 rep from %s", name);
                SendClientMessage(targetid, -1, z);
                format(x, sizeof(x), "Send 1 rep for %s", targetname);   
                SendClientMessage(playerid, -1, x);
                PlayerData[targetid][Rep] += 1;
                PlayerData[playerid][RepTime] = 1;

            }
        }
        return 1;
    }
if clicked on other player not me and click +R3P:
have error:

you can not give yourself
Reply
#4

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;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)