/ma (making admin) help! BUG!!
#1

Hi i need help! when i use
Код:
 /ma 0 6
it tells me about the usage of cmd

pawn Код:
CMD:ma(playerid, pid[], lvl[])
{
    new string[128];
    if(PlayerInfo[playerid][Level] != 6) {
        return 1;
    }
    if(isnull(pid) || isnull(lvl)) {
        SendClientMessage(playerid, COLOR_GREY,"[USAGE] /ma [id] [level]");
        SendClientMessage(playerid, COLOR_GREY,"This will set player(id)'s level");
        return 1;
    }
    new id = strval(pid),level = strval(lvl);
    if(!IsPlayerConnected(id)) {
        SendClientMessage(playerid, COLOR_RED,"[ERROR] Invalid ID");
        return 1;
    }
    new File[256]; format(File,256,"users/%s.sav",PlayerName(id));
    if(!fexist(File)) {
        SendClientMessage(playerid, COLOR_RED,"[ERROR] Player is not registered, cannot setlevel");
        return 1;
    }
    if(PlayerInfo[id][LoggedIn] == 0) {
        SendClientMessage(playerid, COLOR_RED,"[ERROR] Player need to be loggedin to get level");
        return 1;
    }
    if(PlayerInfo[id][Level] == level) {
        SendClientMessage(playerid, COLOR_RED,"[ERROR] player is already on this level");
        return 1;
    }
    if(level > PlayerInfo[id][Level]) {
        GameTextForPlayer(id,"~b~Promoted", 1000, 4);
    }else {
        GameTextForPlayer(id,"~r~Demoted",1000,4);
    }
    if(level == 0) {
        format(string,128,"[ADMIN] %s has fired %s from AdminPannel (%s's Level: %d)",PlayerName(playerid),PlayerName(id),PlayerName(id),level);
    }else {
        format(string,128,"[ADMIN] %s has setted %s's Level: %d  (%s)",PlayerName(playerid),PlayerName(id),level,LevelName(level));
    }
    SendClientMessageToAll(COLOR_LIGHTBLUE,string);
    dini_IntSet(File,"Level",level);
    PlayerInfo[id][Level] = level;
    return 1;
}
Please Help BTW i always make like this without strtok

EXP:
pawn Код:
CMD:setmytime(playerid, hour[], minute[]) //I dont know the command works or not :P
{
   if(isnull(hour) || isnull(minute)) return 1;
   SetPlayerTime(playerid, strval(hour),strval(minute));
   return 1;
}
Reply
#2

Why don't you try using sscanf2 by ******? It's more efficient in handling such cases.
pawn Код:
/*According to settime command*/
CMD:setmytime(playerid, params[])
{
 new min, hr;
 if(sscanf(params, "ii", hr, min)) return SendClientMessage(playerid, -1, "Usage: /setmytime (hour) (minute)");
 SetPlayerTime(playerid, hr, min);
 return 1;
}
.
Reply
#3

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Why don't you try using sscanf2 by ******? It's more efficient in handling such cases.
pawn Код:
/*According to settime command*/
CMD:setmytime(playerid, params[])
{
 new min, hr;
 if(sscanf(params, "ii", hr, min)) return SendClientMessage(playerid, -1, "Usage: /setmytime (hour) (minute)");
 SetPlayerTime(playerid, hr, min);
 return 1;
}
.
Ok i will try!

but i got a problem!!

i dont know how to use it! i mean the "ii" one
Reply
#4

Quote:
Originally Posted by dr.lozer
Посмотреть сообщение
Ok i will try!

but i got a problem!!

i dont know how to use it! i mean the "ii" one
Read the sscanf2 thread - ****** explains how it's used.
Reply
#5

Quote:
Originally Posted by ******
Код:
Format					Use
L(true/false)				Optional logical truthity
l					Logical truthity
K<callback>(default text)		Optional custom operator
k<callback>				Custom operator
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
You should add same amount of specifiers as the command would have (params).
For example:
pawn Код:
Usage: /kick <ID/Part Of Name> (Only for players) -> specifier would be "r".
Usage: /goto <ID/Part Of Name> (For players and Bots) -> specifier would be "u".
Usage: /time <hour> <seconds> (hour and seconds are integers -> specifier would be "ii".
Usage: /ban <ID/Part Of Name> <reason> (Player + reason (string)) -> specifier would be "rs[value]".
Usage: /say <text> (Only string) -> specifier would be "s[value]".
Reply
#6

sscanf is damn hard to understand


Edit: coz im not god in english
Reply
#7

Dr.Lozer that is too my problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)