Hello Need help with giving score to player.. (+ respect)
#1

So the thing is.. I need to give +1 score with command and save it in dini system..

I know how to save it in but how to give the score with command to TEAM members only.

And set it in when player press tab at list shows how much respect points he's got.
Please help me out
Reply
#2

SetPlayerScore(playerid, +1);
Reply
#3

Thank you for your time and now is the prob.. how can I do it.... I'm using dcmd idk how to save and how to give player ++1 score (the command can be use only once every 1 hour..) Please help me out with that..
Reply
#4

pawn Код:
new file[30];
format(file, sizeof(file), "%s.ini", Name(playerid));
if(dini_Exists(file))
{
    dini_IntSet(file, "Score", GetPlayerScore(playerid));
}
For giving score,
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
It would be similar to that

EDIT: Just noticed after an hour,

These would be outside of everything, preferably near the top
pawn Код:
new RestrictTime[MAX_PLAYERS];
new bool:CanUseCmd[MAX_PLAYERS] = true;
This would be in the command
pawn Код:
new RestrictTime[MAX_PLAYERS];
RestrictTime[playerid] = SetTimer("Restriction", 3_600_000, false); //3_600_000 should be an hour in milliseconds
pawn Код:
forward Restriction(playerid);
public Restriction(playerid)
{
    CanUseCmd[playerid] = true;
    KillTimer(RestrictTime[playerid]);
}
Then basically in the command you would check for
pawn Код:
if(CanUseCmd[playerid] == true)
{
    CanUseCmd[playerid] = false;
    //lets do stuff...like set the timer etc
}
I'm not sure how efficient this method is.
Reply
#5

Thanks! For your help but how to use it in cmd
Quote:

dcmd_respect
}
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
return 1;
{

Please help me.. and how to write it in dini
Reply
#6

Do you use sscanf?
Reply
#7

Yeah I'm using sscanf
Reply
#8

pawn Код:
new RestrictTime[MAX_PLAYERS],
    bool:CanUseCmd[MAX_PLAYERS] = true;

dcmd_respect //i dont use dcmd...so this would have to be fixed by you if it's wrong
{
    if(CanUseCmd[playerid] == true)
    {
        new id;
        if(sscanf(params, "r", id)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /respect <playerid/partofname>");
        if(gTeam[playerid] == gTeam[id]) //I'm not sure if you use this or not, however you get their teams, check if they're equal
        {
            SetPlayerScore(id, GetPlayerScore(id)+1); //we set our targets score +1 their current score
            RestrictTime[playerid] = SetTimer("RestrictionOver", 3_600_000, false); //create our timer
            CanUseCmd[playerid] = false; //make it so they can't use this cmd for now
        }
        else return SendClientMessage(playerid, 0xCC0000AA, "This player isn't part of your team!"); //if they aren't the same team error msg
    }
    else return SendClientMessage(playerid, 0xCC0000AA, "You can't use this command yet!"); //if they can't use it yet send an error msg
}

forward RestrictionOver(playerid);
public RestrictionOver(playerid)
{
    CanUseCmd[playerid] = true; //make it so they can use the cmd again
    KillTimer(RestrictTime[playerid]); //kill the timer
}
Basically, that's what it would look like without saving anything....
I'm not sure what you mean by saving something, do you want it to save in their file or?
Reply
#9

Save in player stats.. like Account/$.ini .. I'm so thankful man :0 I have no words what can I say to you..... Really you helped me out.
Reply
#10

I know its only a warning but smth isn't like it need to be..

Quote:

warning 209: function "dcmd_respect" should return a value

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)