[HELP] /setweather command
#1

Help i need this command to be only like this /setweatger (weatherid) but when i got in game and type

/serweather 50 ---> its tell me ID (50) is not an active player i need to give me the weather not ID only weather no player ID help

Код:
 	if(strcmp(cmd, "/setweather", true) == 0 && PlayerAdminLevel[playerid] == 2) // Gives a player money
	{
    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;
    }
    giveplayerid = strval(tmp);
    if(!IsPlayerConnected(giveplayerid)) {
    format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
    new sendername[24];
    new receivername[24];
    GetPlayerName(playerid,sendername, 24);
	GetPlayerName(giveplayerid,receivername, 24);
    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;
    }
    if(!IsPlayerConnected(giveplayerid)) {
    format(string, sizeof(string), "ID (%d) Is not an active player",giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
   	new weather = strval(tmp);
	if(weather < 0 || weather > 50){
	SendClientMessage(playerid,COLOR_ERROR,"WeatherID Cant Be Less Than 0 And More Than 50");
	return 1;
	}
    new s[128];
    new pname[24];
    GetPlayerName(giveplayerid,pname,24);
    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(s, sizeof(s),"You Have Set Server WeatherID To %d",weather);
    SendClientMessage(giveplayerid,COLOR_RED,s);
    return 1;
    }
Reply
#2

Remove this from your cmd:
pawn Код:
if(!IsPlayerConnected(giveplayerid)) {
    format(string, sizeof(string), "ID (%d) Is not an active player",giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
}
When this one is added, the code checks for the existence of the player id, if not it returns the message...
So, you should remove this.
Reply
#3

i remove it from cmd but its still need from me playerid
Reply
#4

bump help im realy dont need to put iD i need only to do like this


/setweather 50 and work with out put player iD
Reply
#5

PHP код:
if(strcmp(cmd"/setweather"true) == && PlayerAdminLevel[playerid] == 2// Gives a player money
{
    new 
weatherstr[128];
    
tmp strtok(cmdtextidx);
    if(!
strlen(tmp))
        return 
SendClientMessage(playeridCOLOR_ERROR"USAGE: /setweather (weatherid)");
    if(!
IsNumeric(tmp))
        return 
SendClientMessage(playeridCOLOR_ERROR"USAGE: /setweather (weatherid) WeatherID Must be a number");
    
weather strval(tmp);
    if(
weather || weather 50)
        return 
SendClientMessage(playerid,COLOR_ERROR,"WeatherID Cant Be Less Than 0 And More Than 50");
    
SetWeather(weather);
    new 
sendername[24];
    
GetPlayerName(playerid,sendername24);
    
format(strsizeof(str), "%s Has Set Server WeatherID To %d",sendernameweather);
    
SendClientMessageToAll(0xB22222AAstring);
    
format(strsizeof(str),"You Have Set Server WeatherID To %d",weather);
    
SendClientMessage(playerid,COLOR_RED,str);
    return 
1;

Reply
#6

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
PHP код:
if(strcmp(cmd"/setweather"true) == && PlayerAdminLevel[playerid] == 2// Gives a player money
{
    new 
weatherstr[128];
    
tmp strtok(cmdtextidx);
    if(!
strlen(tmp))
        return 
SendClientMessage(playeridCOLOR_ERROR"USAGE: /setweather (weatherid)");
    if(!
IsNumeric(tmp))
        return 
SendClientMessage(playeridCOLOR_ERROR"USAGE: /setweather (weatherid) WeatherID Must be a number");
    
weather strval(tmp);
    if(
weather || weather 50)
        return 
SendClientMessage(playerid,COLOR_ERROR,"WeatherID Cant Be Less Than 0 And More Than 50");
    
SetWeather(weather);
    new 
sendername[24];
    
GetPlayerName(playerid,sendername24);
    
format(strsizeof(str), "%s Has Set Server WeatherID To %d",sendernameweather);
    
SendClientMessageToAll(0xB22222AAstring);
    
format(strsizeof(str),"You Have Set Server WeatherID To %d",weather);
    
SendClientMessage(playerid,COLOR_RED,str);
    return 
1;

i have do like its work when i do /setweather 50 or 20 but the weather dont changed its stell normal when i do and ID
Reply
#7

Maybe you have some other scripts altering your server weather... Try to check if there is any.
Reply
#8

There is not some other scripts with weathers help!
Reply
#9

I think the code is right.

You may be making a mistake.
Reply
#10

i will give you btw i try to do in 2 ways SetWeather and SetPlayerWeather and still the same

PHP код:
    if(strcmp(cmd"/setweather"true) == && PlayerAdminLevel[playerid] == 2// Gives a player money
    
{
    new 
weatherstr[128];
    
tmp strtok(cmdtextidx);
    if(!
strlen(tmp)){
    
SendClientMessage(playeridCOLOR_ERROR"USAGE: /setweather (weatherid)");
    return 
1;
    }
    if(!
IsNumeric(tmp)){
    
SendClientMessage(playeridCOLOR_ERROR"USAGE: /setweather (weatherid) WeatherID Must be a number");
    return 
1;
    }
    
weather strval(tmp);
    
tmp strtok(cmdtextidx);
    if(
weather || 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(stringsizeof(string), "Server %s Has Set Server WeatherID To %d",AdminRanks[PlayerAdminLevel[playerid]], weather);
    
SendClientMessageToAll(0xB22222AAstring);
    
format(strsizeof(str),"You Have Set Server WeatherID To %d",weather);
    
SendClientMessage(playerid,COLOR_GREEN,str);
    return 
1;
    } 
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)