Cmd /setmywheater
#1

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

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

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;
	}
Reply
#4

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
Reply
#5

And what if he doesn't uses strtok?
Reply
#6

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

not possible
Reply
#8

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)