10.12.2012, 13:30
Hi i need help! when i use
it tells me about the usage of cmd
Please Help BTW i always make like this without strtok
EXP:
Код:
/ma 0 6
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;
}
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;
}