returning a value thats already returned? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: returning a value thats already returned? (
/showthread.php?tid=174023)
returning a value thats already returned? -
WillyP - 04.09.2010
okden
i started a vip script
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
if(Donator[playerid]==1)
{
SendClientMessage(playerid,COLOR_RED,"lol");
return 1;
}
return 0;
}
}
but i get
C:\Users\Desktop\DeathRace0.3b\gamemodes\viptest.p wn(61) : warning 209: function "OnPlayerCommandText" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
but it does?
but anyhoo thats that tbf
Re: returning a value thats already returned? -
Mauzen - 04.09.2010
You are missing a return for the case, that the command isnt /mycommand. In that case, the if will be skipped, and there will be no return. Add a return 0 in the very last line of the callback, just before the last bracket.
Re: returning a value thats already returned? -
[XST]O_x - 04.09.2010
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
if(Donator[playerid]==1)
{
SendClientMessage(playerid,COLOR_RED,"lol");
}
return 1;
}
return 0;
}
A command must return 1,else it will send you "SERVER: Unknown command." even if the command will affect.
Re: returning a value thats already returned? -
WillyP - 04.09.2010
Quote:
Originally Posted by [XST]O_x
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/mycommand", cmdtext, true, 10) == 0) { if(Donator[playerid]==1) { SendClientMessage(playerid,COLOR_RED,"lol"); } return 1; } return 0; }
A command must return 1,else it will send you "SERVER: Unknown command." even if the command will affect.
|
thanks xst :P
This forum requires that you wait 120 seconds between posts. Please try again in 48 seconds.
fuc sake :l
Re: returning a value thats already returned? -
[XST]O_x - 04.09.2010
No problem,and I am always enjoying seeing people getting pwned and flaming by the anti spam system XD.
Re: returning a value thats already returned? -
WillyP - 04.09.2010
Quote:
Originally Posted by [XST]O_x
No problem,and I am always enjoying seeing people getting pwned and flaming by the anti spam system XD.
|
lol :P
The message you have entered is too short. Please lengthen your message to at least 8 characters.
This forum requires that you wait 120 seconds between posts. Please try again in 53 seconds.
if i see that shit again ima explode D: