Problem with a simple command -
FreeSoul - 22.02.2012
What's the problem with this command? It must set the frequency,but appearently it just says it's below 1 or over 999...I don't see the problem
pawn Код:
//--------------------------------------[SETFREQ]---------------------------------
if(strcmp(cmd,"/setfreq",true)==0)
{
if(PlayerInfo[playerid][pWalkie] == 1)
{
new freq;
freq = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GRAD1,"USAGE: /setfreq [1-999]");
return 1;
}
if(freq < 1 || freq > 999) { SendClientMessage(playerid,COLOR_GREY," Frequence can't go lower than 1 or higher than 999 !"); return 1;}
PlayerInfo[playerid][pFreq] = freq;
format(string, 256, "You set your frequence to %d !", freq);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
}
else
{
SendClientMessage(playerid,COLOR_GREY," You don't have a walkie talkie");
}
return 1;
}
Thanks in advance
Re: Problem with a simple command -
Fires - 22.02.2012
try
pawn Код:
//--------------------------------------[SETFREQ]---------------------------------
if(strcmp(cmd,"/setfreq",true)==0)
{
if(PlayerInfo[playerid][pWalkie] == 1)return SendClientMessage(playerid,COLOR_GREY," You don't have a walkie talkie");
new freq;
freq = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GRAD1,"USAGE: /setfreq [1-999]");
return 1;
}
if(freq < 1 || freq > 999)return SendClientMessage(playerid,COLOR_GREY," Frequence can't go lower than 1 or higher than 999 !");
PlayerInfo[playerid][pFreq] = freq;
format(string, 256, "You set your frequence to %d !", freq);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
return 1;
}
Re: Problem with a simple command -
FreeSoul - 22.02.2012
Still doesn't work.
Re: Problem with a simple command -
Vince - 22.02.2012
Where does
tmp get assigned a value? Right ..
Re: Problem with a simple command -
Fires - 22.02.2012
edit..
Re: Problem with a simple command -
FreeSoul - 22.02.2012
Now I got
pawn Код:
if(strcmp(cmd,"/setfreq",true)==0)
{
if(PlayerInfo[playerid][pWalkie] != 1)return SendClientMessage(playerid,COLOR_GREY," You don't have a walkie talkie");
new freq = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GRAD1,"USAGE: /setfreq [1-999]");
return 1;
}
if(freq < 1 || freq > 999)return SendClientMessage(playerid,COLOR_GREY," Frequence can't go lower than 1 or higher than 999 !");
PlayerInfo[playerid][pFreq] = freq;
format(string, 256, "You set your frequence to %d !", freq);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
return 1;
}
Still does the same,it says it can't get lower that 1 or higher than 999 even if I input a right value,like 50
Re: Problem with a simple command -
SuperViper - 22.02.2012
pawn Код:
if(strcmp(cmd,"/setfreq",true)==0)
{
if(PlayerInfo[playerid][pWalkie] != 1)return SendClientMessage(playerid,COLOR_GREY," You don't have a walkie talkie");
new freq;
tmp = strtok(cmdtext, idx);
freq = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GRAD1,"USAGE: /setfreq [1-999]");
return 1;
}
if(freq < 1 || freq > 999)return SendClientMessage(playerid,COLOR_GREY," Frequence can't go lower than 1 or higher than 999 !");
PlayerInfo[playerid][pFreq] = freq;
format(string, 256, "You set your frequence to %d !", freq);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
return 1;
}