VIP CMD help
#1

hello, i made this CMD for my Vip players so that they can set there weather not everyones:-
PHP код:
CMD:vweather(playerid, params[])
{
 if(
GetPVarInt(playerid, "DonateRank") <= 1)
 {
  
SendClientMessage(playerid, 0xAA3333AA, "You are not a VIP!");
  return 
1;
 }
 new 
weather;
 if(
sscanf(params, "d", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]");
 if(
weather < 0||weather > 45) { SendClientMessage(playerid, 0xAA3333AA, "Weather ID can't be below 0 or above 45!"); return 1; }
 
SetPlayerWeather(playerid, weather);
 
SendClientMessage(playerid, 0xC2A2DAAA, "Weather Set!");
 return 
1;
} 
but it gives this error:-
PHP код:
D:\michael\filterscripts\Command(2).pwn(58) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664     Copyright (c) 1997-2006, ITB CompuPhase
1 Error
. 
And this the line where the error is coming:-
PHP код:
if(sscanf(params, "d", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]"); 
kindly tell me how to fix it?
Reply
#2

Weather id's are an interger.
So this would become the line:

PHP код:
if(sscanf(params, "i", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]"); 
Reply
#3

Quote:
Originally Posted by Travalle
Посмотреть сообщение
hello, i made this CMD for my Vip players so that they can set there weather not everyones:-
PHP код:
CMD:vweather(playerid, params[])
{
 if(
GetPVarInt(playerid, "DonateRank") <= 1)
 {
  
SendClientMessage(playerid, 0xAA3333AA, "You are not a VIP!");
  return 
1;
 }
 new 
weather;
 if(
sscanf(params, "d", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]");
 if(
weather < 0||weather > 45) { SendClientMessage(playerid, 0xAA3333AA, "Weather ID can't be below 0 or above 45!"); return 1; }
 
SetPlayerWeather(playerid, weather);
 
SendClientMessage(playerid, 0xC2A2DAAA, "Weather Set!");
 return 
1;
} 
but it gives this error:-
PHP код:
D:\michael\filterscripts\Command(2).pwn(58) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664     Copyright (c) 1997-2006, ITB CompuPhase
1 Error
. 
And this the line where the error is coming:-
PHP код:
if(sscanf(params, "d", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]"); 
kindly tell me how to fix it?
I tested your cmd in my gm i didn't get single error in that.
Reply
#4

Quote:
Originally Posted by justjamie
Посмотреть сообщение
Weather id's are an interger.
So this would become the line:

PHP код:
if(sscanf(params, "i", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]"); 
Both d and i can be an integer.
Reply
#5

try this

PHP код:
CMD:vweather(playerid, params[]) 
{ 
 if(
GetPVarInt(playerid, "DonateRank") <= 1) 
 { 
  
SendClientMessage(playerid, 0xAA3333AA, "You are not a VIP!"); 
  return 
1; 
 } 

 new 
weather; 
 if(
sscanf(params, "d", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]"); 

 if(
weather < 0 || weather > 45) return SendClientMessage(playerid, 0xAA3333AA, "Weather ID can't be below 0 or above 45!");
 
SetPlayerWeather(playerid, weather); 
 
SendClientMessage(playerid, 0xC2A2DAAA, "Weather Set!"); 
 return 
1; 
} 
Reply
#6

still getting the same error:-
PHP код:
D:\michaelwcrp\filterscripts\Command(2).pwn(58) : warning 217: loose indentation
D
:\michaelwcrp\filterscripts\Command(2).pwn(58) : error 035: argument type mismatch (argument 1)
D:\michaelwcrp\filterscripts\Command(2).pwn(60) : warning 217: loose indentation
Pawn compiler 3.2.3664              Copyright 
(c) 1997-2006, ITB CompuPhase

1 Error
. 
Reply
#7

Quote:
Originally Posted by Slawiii
Посмотреть сообщение
try this

PHP код:
CMD:vweather(playerid, params[]) 
{ 
 if(
GetPVarInt(playerid, "DonateRank") <= 1) 
 { 
  
SendClientMessage(playerid, 0xAA3333AA, "You are not a VIP!"); 
  return 
1; 
 } 
 new 
weather; 
 if(
sscanf(params, "d", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]"); 
 if(
weather < 0 || weather > 45) return SendClientMessage(playerid, 0xAA3333AA, "Weather ID can't be below 0 or above 45!");
 
SetPlayerWeather(playerid, weather); 
 
SendClientMessage(playerid, 0xC2A2DAAA, "Weather Set!"); 
 return 
1; 
} 
You just changed the messages from inbrackets to returning option.
Reply
#8

Align your script and you will not get any loose indentation warnings.
PHP код:
CMD:vweather(playerid, params[])
{
    if(
GetPVarInt(playerid, "DonateRank") <= 1)
    {
         
SendClientMessage(playerid, 0xAA3333AA, "You are not a VIP!");
         return 
1;
    }
    new 
weather;
    if(
sscanf(params, "d", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]");
    if(
weather < 0||weather > 45) { SendClientMessage(playerid, 0xAA3333AA, "Weather ID can't be below 0 or above 45!"); return 1; }
    
SetPlayerWeather(playerid, weather);
    
SendClientMessage(playerid, 0xC2A2DAAA, "Weather Set!");
    return 
1;
} 
Reply
#9

Try this, worked fine for me.

PHP код:
CMD:vweather(playerid, params[]) 
{ 
     if(
GetPVarInt(playerid, "DonateRank") <= 1) return SendClientMessage(playerid, 0xAA3333AA, "You are not a VIP!"); 

     new 
weather; 
     if(
sscanf(params, "d", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]"); 

     if(
weather < 0||weather > 45) { SendClientMessage(playerid, 0xAA3333AA, "Weather ID can't be below 0 or above 45!"); return 1; } 
     
SetPlayerWeather(playerid, weather); 
     
SendClientMessage(playerid, 0xC2A2DAAA, "Weather Set!"); 
     return 
1; 
} 
Reply
#10

Код:
CMD:vweather(playerid, params[]) 
{ 
 	if(GetPVarInt(playerid, "DonateRank") <= 1) return SendClientMessage(playerid, 0xAA3333AA, "You are not a VIP!"); 

 	new weather; 
 	if(sscanf(params, "d", weather)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /vweather [weatherid]"); 

 	if(weather < 0||weather > 45) { SendClientMessage(playerid, 0xAA3333AA, "Weather ID can't be below 0 or above 45!"); return 1; } 
 	SetPlayerWeather(playerid, weather); 
 	SendClientMessage(playerid, 0xC2A2DAAA, "Weather Set!"); 
 	return 1; 
}
EDIT: Too late.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)