SA-MP Forums Archive
Cmd /setmywheater - 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: Cmd /setmywheater (/showthread.php?tid=421341)



Cmd /setmywheater - toi - 09.03.2013

Hello, I wanted to know how I could create the cmd / setmywheater [ID wheater]
I still use strcmp, thanks


Re: Cmd /setmywheater - DiGiTaL_AnGeL - 09.03.2013

Why don't you use the RCON command "/rcon weather [weather id]"?


Re: Cmd /setmyweather - Stanford - 09.03.2013

Here you go:
If I helped you, gimme a reputation ma bro!

Код:
	if(strcmp(cmd, "/setweather", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pAdmin] < 1337 && IsGod[playerid] == 0) { return 1; }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setweather [weatherid]"); return 1; }
			new weather;
			weather = strvalEx(tmp);
			SetWeather(weather);
			SendClientMessage(playerid, COLOR_GREY, "   Weather has been set for everyone !");
		}
		return 1;
	}



Re: Cmd /setmywheater - Bikken - 09.03.2013

pawn Код:
if(strcmp(cmd, "/setweather", true) == 0 && PlayerAdminLevel[playerid] == 2) // Gives a player money
    {
    new weather, str[128];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)){
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /setweather (weatherid)");
    return 1;
    }
    if(!IsNumeric(tmp)){
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /setweather (weatherid) WeatherID Must be a number");
    return 1;
    }
    weather = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(weather < 0 || weather > 50){
    SendClientMessage(playerid,COLOR_ERROR,"WeatherID Cant Be Less Than 0 And More Than 50");
    return 1;
    }
    for(new i=0;i<MAX_PLAYERS;i++)
    SetPlayerWeather(i,weather);
    format(string, sizeof(string), "Server %s Has Set Server WeatherID To %d",AdminRanks[PlayerAdminLevel[playerid]], weather);
    SendClientMessageToAll(0xB22222AA, string);
    format(str, sizeof(str),"You Have Set Server WeatherID To %d",weather);
    SendClientMessage(playerid,COLOR_GREEN,str);
    return 1;
    }
Try this, credits don't go to me


Re: Cmd /setmywheater - DiGiTaL_AnGeL - 09.03.2013

And what if he doesn't uses strtok?


Re: Cmd /setmywheater - toi - 09.03.2013

the command / setmywheater must change the time only that player and not at all, the player must be able to change it without admin


Re : Cmd /setmywheater - LittleSamp - 09.03.2013

not possible


Re: Cmd /setmywheater - toi - 09.03.2013

instead it is possible, I've seen it on other servers


Re: Cmd /setmywheater - MassDivide - 09.03.2013

Quote:
Originally Posted by DiGiTaL_AnGeL
Посмотреть сообщение
And what if he doesn't uses strtok?
Then he should be advanced enough to convert it