SA-MP Forums Archive
Points. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Points. (/showthread.php?tid=269067)



Points. - iGetty - 14.07.2011

How can I make a command, for this:

pawn Код:
command(setpoints, playerid, params[])
{
    Player[playerid][Points] ++;
    return 1;
}

But instead of doing it for that person, could I have some help to get it like this:

pawn Код:
command(setpoints, playerid, params[])
{
    Then here the things go, for a cop to set a players points, and an amount of points? :3
}
Thanks.


Re: Points. - Toreno - 14.07.2011

Something like this?
pawn Код:
CMD:setpoints(playerid, params[]) {
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /setpoints [ID].");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "SERVER: playerid is not connected.");
    Player[id][Points]++;
    return 1;
}



Re: Points. - iGetty - 14.07.2011

I want it so then the cop can choose how many points to add :$.


Re: Points. - Toreno - 14.07.2011

Maybe this?
pawn Код:
CMD:setpoints(playerid, params[]) {
    new id, value;
    if(sscanf(params, "ui", id, value)) return SendClientMessage(playerid, -1, "USAGE: /setpoints [ID] [VALUE].");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "SERVER: playerid is not connected.");
    // I don't know which way you use to check if player is a cop or not...
    // Edit this, so the if would be "IF PLAYER IS NOT A COP", that's all, I GUESS?
    if(!...) return SendClientMessage(playerid, -1, "You are not a cop!");
    PlayerPoints[id] += value;
    return 1;
}



Re: Points. - Raimis_R - 14.07.2011

pawn Код:
command(setpoints, playerid, params[] )
{
    if ( !IsPlayerCop[ playerid ] ) return 0; // Example
   
    new
        giveplayerid,
        points;

    if ( sscanf( params, "ri", giveplayerid, points ) ) SendClientMessage( playerid, -1, "* Usage: /setpoints [Nick/ID] [Points]" );
    else if ( giveplayerid == INVALID_PLAYER_ID ) SendClientMessage( playerid, -1, "* Player not found!" );
    else
    {
        Player[ playerid ][ Points ] += pointrs;
    }
    return 1;
}
To slow :/