}
COMMAND:weather(playerid, params[])
{
if(AccountInfo[playerid][aAdmin] >= ADMIN_LVL_TRAIN)
{
new weather;
new idx = 0;
new tmp[32];
tmp = strtok(params,idx);
if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /weather [weatherID]"); return 1; }
if(weather < 0||weather > 45) { SendClientMessage(playerid, COLOR_GREY, " Weather ID can't be below 0 or above 45!"); return 1; }
SetWeather(weather);
gWeather = weather;
SendClientMessage(playerid, COLOR_GREY, "Weather set to everyone!");
}
else
{
SendErrorMsg(playerid,"You are not an admin.");
return 1;
}
}
COMMAND:weather(playerid, params[])
{
if(AccountInfo[playerid][aAdmin] >= ADMIN_LVL_TRAIN)
{
new weather;
new idx = 0;
new tmp[32];
tmp = strtok(params,idx);
if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /weather [weatherID]"); return 1; }
if(weather < 0||weather > 45) { SendClientMessage(playerid, COLOR_GREY, " Weather ID can't be below 0 or above 45!"); return 1; }
SetWeather(weather);
gWeather = weather;
SendClientMessage(playerid, COLOR_GREY, "Weather set to everyone!");
}
else
{
SendErrorMsg(playerid,"You are not an admin.");
return 1;
}
return 1;
}
You must return 1.
pawn Код:
|
I am still wondering why you are using the "return 1" 2 times... instead of 1.
|
cmd:weather(playerid, params[]) { if(AccountInfo[playerid][aAdmin] >= ADMIN_LVL_TRAIN) { new weather; new idx = 0; new tmp[32]; tmp = strtok(params,idx); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /weather [weatherID]"); return 1; } if(weather < 0||weather > 45) { SendClientMessage(playerid, COLOR_GREY, " Weather ID can't be below 0 or above 45!"); return 1; } SetWeather(weather); gWeather = weather; SendClientMessage(playerid, COLOR_GREEN, "Weather set!"); } else { SendErrorMsg(playerid,"You are not an admin."); return 1; } return 1; }
if(strcmp(cmd, "/weather", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pAdmin] < 4) //The Admin level rank to use the command <<< // { SendClientMessage(playerid, COLOR_RED, " You do not have access to this command!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "{33CCFF}USAGE:{FFFFFF} /weather [weatherid]"); return 1; } new weather; weather = strval(tmp); if(weather < 0||weather > 150) { SendClientMessage(playerid, COLOR_GREY, " Weather ID can't be below 0 or above 45!"); return 1; } SetWeather(weather); SendClientMessage(playerid, COLOR_GREY, " Weather Set to everyone!"); GetPlayerName(playerid, sendername, sizeof(sendername)); if(PlayerInfo[playerid][pAdmin] == 11) { sendername = "Hidden Admin"; } format(string, 256, "AdmWarning: %s has changed the weather to %d.", sendername,weather); ABroadCast(COLOR_YELLOW,string,1); } return 1; }
COMMAND:weather(playerid, params[]) {
if(AccountInfo[playerid][aAdmin] >= ADMIN_LVL_TRAIN) {
new weather, idx = 0, tmp[32];
tmp = strtok(params,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /weather [weatherID]");
} else if(weather < 0||weather > 45) {
SendClientMessage(playerid, COLOR_GREY, " Weather ID can't be below 0 or above 45!");
} else {
SetWeather(weather);
gWeather = weather;
SendClientMessage(playerid, COLOR_GREY, "Weather set to everyone!");
}
} else {
SendClientMessage(playerid,COLOR_LIGHTRED,"You are not an admin.");
}
return 1;
}