/makefleader command doesn't show anything on a player's screen, and doesn't work in general.
#1

/makefleader doesn't work even compiling is successful, any idea on what's wrong with this code?
PHP Code:
CMD:makefleader(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1338)
    {
        new 
targetidfaction;
        if(
sscanf(params"Ui"targetidfaction)) return SCM(playeridCOLOR_RED"USAGE: /makefleader [name/id] [faction]");
        if(
targetid != INVALID_PLAYER_ID)
        {
            
PlayerInfo[targetid][pFaction] = faction;
            
PlayerInfo[targetid][pFRank] = 10
            
PlayerInfo[targetid][pFLeader] = faction;
            if(
faction == 1)
            {
                
SCM(targetidCOLOR_LIGHTBLUE"An admin has made a you faction leader of the Los Santos Police Department.");
                
SendClientMessage(targetidCOLOR_LIGHTBLUE"You are now leader of the Los Santos Police Department."); 
            }
        }
        else
        {
            
SCM(playeridCOLOR_RED"This player is not connected.");
        }
    }
    else
    {
            
SendClientMessage(playeridCOLOR_RED"Your Administration rank is not high enough to access this command");
    }
    return 
1;

Player Data:

Before entering the command:

After entering the command:
Reply
#2

Try this:

PHP Code:
CMD:makefleader(playeridparams[]) 

    if(
PlayerInfo[playerid][pAdmin] >= 1338
    { 
        new 
targetidfaction
        if(
sscanf(params"ui"targetidfaction)) return SCM(playeridCOLOR_RED"USAGE: /makefleader [name/id] [faction]"); 
        if(
IsPlayerConnected(targetid)) 
        { 
            
PlayerInfo[targetid][pFaction] = faction
            
PlayerInfo[targetid][pFRank] = 10;  
            
PlayerInfo[targetid][pFLeader] = faction
            if(
faction == 1
            { 
                
SCM(targetidCOLOR_LIGHTBLUE"An admin has made a you faction leader of the Los Santos Police Department."); 
                
SendClientMessage(targetidCOLOR_LIGHTBLUE"You are now leader of the Los Santos Police Department.");  
            } 
            else 
            { 
                
SCM(playeridCOLOR_RED"This faction doesn't exist."); 
            } 
        } 
        else 
        { 
            
SCM(playeridCOLOR_RED"This player is not connected."); 
        } 
    } 
    else 
    { 
            
SendClientMessage(playeridCOLOR_RED"Your Administration rank is not high enough to access this command"); 
    } 
    return 
1

Reply
#3

Quote:
Originally Posted by Kaliber
View Post
Try this:

PHP Code:
CMD:makefleader(playeridparams[]) 

    if(
PlayerInfo[playerid][pAdmin] >= 1338
    { 
        new 
targetidfaction
        if(
sscanf(params"ui"targetidfaction)) return SCM(playeridCOLOR_RED"USAGE: /makefleader [name/id] [faction]"); 
        if(
IsPlayerConnected(targetid)) 
        { 
            
PlayerInfo[targetid][pFaction] = faction
            
PlayerInfo[targetid][pFRank] = 10;  
            
PlayerInfo[targetid][pFLeader] = faction
            if(
faction == 1
            { 
                
SCM(targetidCOLOR_LIGHTBLUE"An admin has made a you faction leader of the Los Santos Police Department."); 
                
SendClientMessage(targetidCOLOR_LIGHTBLUE"You are now leader of the Los Santos Police Department.");  
            } 
            else 
            { 
                
SCM(playeridCOLOR_RED"This faction doesn't exist."); 
            } 
        } 
        else 
        { 
            
SCM(playeridCOLOR_RED"This player is not connected."); 
        } 
    } 
    else 
    { 
            
SendClientMessage(playeridCOLOR_RED"Your Administration rank is not high enough to access this command"); 
    } 
    return 
1

Yup, thank you! The "Ui" format in the sscanf was what made it not work :P, I thought it would though cuz look at this one,
Quote:

Originally Posted by Y_Less View Post
Code:
PHP Code:
Format                    Use
L(true/false)                Optional logical truthity
l                    Logical truthity
B
(binary)                Optional binary number
b                    Binary number
N
(any format number)            Optional number
n                    Number
C
(character)                Optional character
c                    Character
I
(integer)                Optional integer
i                    Integer
D
(integer)                Optional integer
d                    Integer
H
(hex value)                Optional hex number
h                    Hex number
O
(octal value)                Optional octal value
o                    Octal value
F
(float)                Optional floating point number
f                    Floating point number
G
(float/INFINITY/-INFINITY/NAN/NAN_E)    Optional float with IEEE definitions
g                    Float with IEEE definitions
{                    Open quiet section
}                    Close quiet section
P
<delimiter>                Invalid delimiter change
p
<delimiter>                Delimiter change
Z
(string)[length]            Invalid optional string
z
(string)[length]            Deprecated optional string
S
(string)[length]            Optional string
s
[length]                String
U
(name/id)                Optional user (bot/player)
u                    User (bot/player)
Q(name/id)                Optional bot (bot)
q                    Bot (bot)
R(name/id)                Optional player (player)
r                    Player (player)
A<type>(default)[length]        Optional array of given type
a
<type>[length]                Array of given type
E
<specification>(default)        Optional enumeration of given layout
e
<specification>            Enumeration of given layout
'string'                Search string
%                    Deprecated optional specifier prefix 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)