/giverank
#1

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

What kind of rank you wanna give?
Reply
#3

Rank/Level
Reply
#4

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
Reply
#5

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

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

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

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...
Reply
#9

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);
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)