SA-MP Forums Archive
/giverank - 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)
+--- Thread: /giverank (/showthread.php?tid=380685)



/giverank - Blackazur - 26.09.2012

How can i script a /giverank Command? So that i can give Players a Rank for whatever Reason.


Re: /giverank - ikbenremco - 26.09.2012

What kind of rank you wanna give?


AW: /giverank - Blackazur - 26.09.2012

Rank/Level


Re: AW: /giverank - HyDrAtIc - 26.09.2012

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
Rank/Level
He mean's level/rank for what?

EG:

a /giverank command for giving a player rank 3 for SWAT team..

Like this what he ment not this


AW: /giverank - Blackazur - 26.09.2012

/giverank so that he can use better Weapons and other. or /givescore to give a Player Score.


Re: /giverank - Sasoft - 26.09.2012

Put this on top of your script
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
You could put this on the bottom of your script.
pawn Код:
COMMAND:givescore(playerid, params[]){
    new target, score; // Defining the target and the score you want to give
    if(sscanf(params, "ud", target, params)){ // Checks if you typed everything in the right order. ( Target first and the amount of score you wish to give)
        SendClientMessage(playerid, 0xFFFFFFFF, "/givescore [target] [score]"); // Sends this message if you didn't typ it in the right order.
        return 1; // returns so the command doesen't execute when you type in the wrong order.
    }
    SetPlayerScore(target, score); // Sets the target to the selected score.
    return 1;
}



Re: /giverank - SmithyComp - 26.09.2012

pawn Код:
CMD:giverank(playerid, params[])
{
    if (PlayerInfo[playerid][pLeader] >= 1)
    {
        new string[128], giveplayerid, rank;
        if(sscanf(params, "ud", giveplayerid, rank)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /giverank [playerid] [Rank (1-6)]");

        if(rank > 6 || rank < 0) { SendClientMessageEx(playerid, COLOR_GREY, "   Don't go below number 0, or above number 6!"); return 1; }

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[playerid][pLeader] != PlayerInfo[giveplayerid][pMember])
            {
                SendClientMessageEx(playerid, COLOR_GRAD1, "   That person is not in your faction!");
                return 1;
            }

            if(rank > PlayerInfo[giveplayerid][pRank])
            {
                format(string, sizeof(string), "   You have been promoted to a higher rank by %s.", GetPlayerNameEx(playerid));
            }
            if(rank < PlayerInfo[giveplayerid][pRank])
            {
                format(string, sizeof(string), "   You have been demoted to a lower rank by %s.", GetPlayerNameEx(playerid));
            }
            PlayerInfo[giveplayerid][pRank] = rank;
            SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "   You have given %s rank %d.", GetPlayerNameEx(giveplayerid),rank);
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command (leaders only)!");
    }
    return 1;
}



Re: /giverank - HyDrAtIc - 26.09.2012

Quote:
Originally Posted by Sasoft
Посмотреть сообщение
Put this on top of your script
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
You could put this on the bottom of your script.
pawn Код:
COMMAND:givescore(playerid, params[]){
    new target, score; // Defining the target and the score you want to give
    if(sscanf(params, "ud", target, params)){ // Checks if you typed everything in the right order. ( Target first and the amount of score you wish to give)
        SendClientMessage(playerid, 0xFFFFFFFF, "/givescore [target] [score]"); // Sends this message if you didn't typ it in the right order.
        return 1; // returns so the command doesen't execute when you type in the wrong order.
    }
    SetPlayerScore(target, score); // Sets the target to the selected score.
    return 1;
}
Here check what you've done wrong
Quote:
Originally Posted by Sasoft
Посмотреть сообщение
pawn Код:
SetPlayerScore(target, score); // Sets the target to the selected score.
Look carefully about your code here you have putted SetPlayerScore function this going to set the score repair your code and use the GivePlayerScore function...


Re: /giverank - RedJohn - 26.09.2012

Quote:
Originally Posted by Sasoft
Посмотреть сообщение
Put this on top of your script
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
You could put this on the bottom of your script.
pawn Код:
COMMAND:givescore(playerid, params[]){
    new target, score; // Defining the target and the score you want to give
    if(sscanf(params, "ud", target, params)){ // Checks if you typed everything in the right order. ( Target first and the amount of score you wish to give)
        SendClientMessage(playerid, 0xFFFFFFFF, "/givescore [target] [score]"); // Sends this message if you didn't typ it in the right order.
        return 1; // returns so the command doesen't execute when you type in the wrong order.
    }
    SetPlayerScore(target, score); // Sets the target to the selected score.
    return 1;
}
pawn Код:
SetPlayerScore(target, score);
to
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) + score);



Re: /giverank - Sasoft - 26.09.2012

Quote:
Originally Posted by James_Nick
Посмотреть сообщение
Here check what you've done wrong


Look carefully about your code here you have putted SetPlayerScore function this going to set the score repair your code and use the GivePlayerScore function...
Ehm, I don't think that GivePlayerScore is a official sa-mp function. Since i can't find it anywhere.