the cmd doesn't commit - 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: the cmd doesn't commit (
/showthread.php?tid=588029)
WITHDRAWN / FIXED -
saffierr - 04.09.2015
Somehow the cmd doesn't commit.
When I type /setweather 2, it shows me the sscanf....
PHP код:
CMD:setweather(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new targetplayers, weatherid;
if(sscanf(params, "ui", targetplayers, weatherid)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /setweather [weatherid]");
if(weatherid < 0 || weatherid > 20) return SendClientMessage(playerid, COLOR_RED, "Error: Available weatherids 0 - 20");
new string[100];
SetPlayerWeather(targetplayers, weatherid);
format(string, sizeof string, "An admin has set the weather to %i.", weatherid);
SendClientMessageToAll(COLOR_GREEN, string);
return 1;
}
Re: the cmd doesn't commit -
AmirHossaiN - 04.09.2015
this command has 2 params,
target player and weather.
use /setweather playerid weatherid.
for /setweather weatherid
you must use it:
PHP код:
CMD:setweather(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new targetplayers, weatherid;
if(sscanf(params, "i", weatherid)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /setweather [weatherid]");
if(weatherid < 0 || weatherid > 20) return SendClientMessage(playerid, COLOR_RED, "Error: Available weatherids 0 - 20");
new string[100];
SetPlayerWeather(targetplayers, weatherid);
format(string, sizeof string, "An admin has set the weather to %i.", weatherid);
SendClientMessageToAll(COLOR_GREEN, string);
return 1;
}
PHP код:
if(sscanf(params, "ui", targetplayers, weatherid)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /setweather [weatherid]");
to:
PHP код:
if(sscanf(params, "i", weatherid)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /setweather [weatherid]");
if you want set weather for all players. you can use SetWeather(weather); instead of SetPlayerWeather(targetplayers, weatherid);
or if you want set weather for yourself, you can use SetPlayerWeather(playerid, weatherid);
WITHDRAWN / FIXED -
saffierr - 04.09.2015
WITHDRAWN....
Fixed it lol.....
Anyways, Amir thank you for your reply, I would've fixed it with your reply either.