MyWeather Command - 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: MyWeather Command (
/showthread.php?tid=452948)
MyWeather Command -
martoivanov - 23.07.2013
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;
}
Re: MyWeather Command -
maxpain43 - 23.07.2013
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);
Re: MyWeather Command -
martoivanov - 23.07.2013
Thank you man