/makeleader
#1

How am I able to create a /makeleader command? I believe you need the following to help me.

pawn Код:
RCSD[targetid] = 0;
Reply
#2

Alright.

We gotta use sscanf for it.

Код:
CMD:makeleader(playerid, params[]) // ZCMD
{
     new Id, fId; // Id is gonna stand for targetid and fId is for faction Id.
    
     if(!admin varible) return SendClientMessage(playerid, -1, "You are not an admin!"); 

     if(!IsPlayerConnected(Id)) return SendClientMessage(playerid, -1, "The player is not online!"); 

     if(sscanf(params, "dd", Id, fId) return SendClientMessage(playerid, -1, "USAGE: /makeleader [playerid/partofname] [faction id]");

     RSCD[Id] = fId;

     return 1;
}
Reply
#3

Sabur, your command has a bug in it.
You should the IsPlayerConencted line UNDER sscanf, as Id = 0 when you don't assign it to something.
Reply
#4

Quote:
Originally Posted by Sabur
Посмотреть сообщение
Alright.

We gotta use sscanf for it.

Код:
CMD:makeleader(playerid, params[]) // ZCMD
{
     new Id, fId; // Id is gonna stand for targetid and fId is for faction Id.
    
     if(!admin varible) return SendClientMessage(playerid, -1, "You are not an admin!"); 

     if(!IsPlayerConnected(Id)) return SendClientMessage(playerid, -1, "The player is not online!"); 

     if(sscanf(params, "dd", Id, fId) return SendClientMessage(playerid, -1, "USAGE: /makeleader [playerid/partofname] [faction id]");

     RSCD[Id] = fId;

     return 1;
}
Thanks bro, +rep. But it's not working lol.
Reply
#5

Quote:
Originally Posted by mkmk
Посмотреть сообщение
Thanks bro, +rep. But it's not working lol.
Make sure you got the right variable.
Reply
#6

Quote:
Originally Posted by Sabur
Посмотреть сообщение
Make sure you got the right variable.
I did.
Reply
#7

pawn Код:
CMD:makeleader(playerid, params[])
    {
        new id, fID;

        if(sscanf(params, "dd", id)) return SendClientMessage(playerid, -1, "Usage: /makeleader <playerid> <factionid>")
        {
            if(id != INVALID_PLAYER_ID)
            {
                if(!strcmp(fID, "1"))
                {
                    RCSD[id] = 1;
                }
                if(!strcmp(fID, "2"))
                {
                    RCSD[id] = FACTION_ID_2;
                }
            }
            else return SendClientMessage(playerid, -1, "Player not connected");
        }
    }
Reply
#8

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Sabur, your command has a bug in it.
You should the IsPlayerConencted line UNDER sscanf, as Id = 0 when you don't assign it to something.
Oh, Thanks for pointing it out!
Reply
#9

Quote:
Originally Posted by sammp
Посмотреть сообщение
pawn Код:
CMD:makeleader(playerid, params[])
    {
        new id, fID;

        if(sscanf(params, "dd", id)) return SendClientMessage(playerid, -1, "Usage: /makeleader <playerid> <factionid>")
        {
            if(id != INVALID_PLAYER_ID)
            {
                if(!strcmp(fID, "1"))
                {
                    RCSD[id] = 1;
                }
                if(!strcmp(fID, "2"))
                {
                    RCSD[id] = FACTION_ID_2;
                }
            }
            else return SendClientMessage(playerid, -1, "Player not connected");
        }
    }
What the hell? You are going to use strcmp and you already have sscanf?
Код:
if(sscanf(params, "dd", id, fID))
Reply
#10

woops i posted that when I just woke up, lol I see the problem XD

I'm a fucking idiot, lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)