MyWeather Command
#1

When i type /myweather it always returns me the message that i have to use: /myweather [wheatherid] ?
pawn Код:
if (strcmp(cmd, "/myweather", true) == 0)
{
    if(pInfo[playerid][VIPlevel] >= 1) {
    new weather;
    if ( sscanf( cmd, "d", weather ) ) return SendClientMessage( playerid, COLOR_WHITE, "Use: {FFFF00}/myweather [weatherid]" );
    if ( ( weather < 0 ) || ( weather > 52 ) ) return SendClientMessage( playerid, COLOR_WHITE, "asd 0 asd 52!" );
    SetPlayerWeather( playerid, weather );
    format( string, sizeof( string ), "asdasdasdas {E60000}%d", weather );
    SendClientMessage( playerid, COLOR_YELLOW, string );
    }
    return 1;
}
Reply
#2

Im using this way of the /weather, and it works great.
Код:
if(strcmp(cmd, "/weather", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		if(PlayerInfo[playerid][pAdmin] < 1337)
		{
			SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
			return 1;
		}
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /weather [weatherid]");
			return 1;
		}
		new weather;
		weather = strvalEx(tmp);
		if(weather < 0||weather > 45) { SendClientMessage(playerid, COLOR_GREY, "   Weather ID can't be below 0 or above 45 !"); return 1; }
		SetPlayerWeather(playerid, weather);
		SendClientMessage(playerid, COLOR_GREY, "   Weather has been set !");
	}
	return 1;
}
Try using
Код:
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /myweather [weatherid]");
			return 1;
		}
		new weather;
                weather = strvalEx(tmp);
Reply
#3

Thank you man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)