/makefleader command doesn't show anything on a player's screen, and doesn't work in general. - 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: /makefleader command doesn't show anything on a player's screen, and doesn't work in general. (
/showthread.php?tid=618367)
/makefleader command doesn't show anything on a player's screen, and doesn't work in general. -
Gorgeousmaniac - 05.10.2016
/makefleader doesn't work even compiling is successful, any idea on what's wrong with this code?
PHP Code:
CMD:makefleader(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1338)
{
new targetid, faction;
if(sscanf(params, "Ui", targetid, faction)) return SCM(playerid, COLOR_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(targetid, COLOR_LIGHTBLUE, "An admin has made a you faction leader of the Los Santos Police Department.");
SendClientMessage(targetid, COLOR_LIGHTBLUE, "You are now leader of the Los Santos Police Department.");
}
}
else
{
SCM(playerid, COLOR_RED, "This player is not connected.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Your Administration rank is not high enough to access this command");
}
return 1;
}
Player Data:

Before entering the command:

After entering the command:
Re: /makefleader command doesn't show anything on a player's screen, and doesn't work in general. -
Kaliber - 05.10.2016
Try this:
PHP Code:
CMD:makefleader(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1338)
{
new targetid, faction;
if(sscanf(params, "ui", targetid, faction)) return SCM(playerid, COLOR_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(targetid, COLOR_LIGHTBLUE, "An admin has made a you faction leader of the Los Santos Police Department.");
SendClientMessage(targetid, COLOR_LIGHTBLUE, "You are now leader of the Los Santos Police Department.");
}
else
{
SCM(playerid, COLOR_RED, "This faction doesn't exist.");
}
}
else
{
SCM(playerid, COLOR_RED, "This player is not connected.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Your Administration rank is not high enough to access this command");
}
return 1;
}
Re: /makefleader command doesn't show anything on a player's screen, and doesn't work in general. -
Gorgeousmaniac - 05.10.2016
Quote:
Originally Posted by Kaliber
Try this:
PHP Code:
CMD:makefleader(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1338)
{
new targetid, faction;
if(sscanf(params, "ui", targetid, faction)) return SCM(playerid, COLOR_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(targetid, COLOR_LIGHTBLUE, "An admin has made a you faction leader of the Los Santos Police Department.");
SendClientMessage(targetid, COLOR_LIGHTBLUE, "You are now leader of the Los Santos Police Department.");
}
else
{
SCM(playerid, COLOR_RED, "This faction doesn't exist.");
}
}
else
{
SCM(playerid, COLOR_RED, "This player is not connected.");
}
}
else
{
SendClientMessage(playerid, COLOR_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
|