Warning - 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: Warning (
/showthread.php?tid=269506)
Warning -
cloudysky - 16.07.2011
pawn Код:
warning 209: function "OnPlayerUpdate" should return a value
Hi, I need this to work so I can become "Invisible" to other players.
pawn Код:
public OnPlayerUpdate(playerid)
{
if( PlayerInfo[playerid][Invisible] == 1)
return 0;
}
Re: Warning -
Backwardsman97 - 16.07.2011
I don't think it works like that. The reason the compiler is telling you that is because you're saying, "If invisible equals one, then return 0". You still aren't telling it what to return to OnPlayerUpdate.
Re: Warning -
cloudysky - 16.07.2011
pawn Код:
public OnPlayerUpdate(playerid)
{
{
if( PlayerInfo[playerid][Invisible] == 1)
{
SendClientMessage(playerid, COLOUR_WHITE, "Inv" );
}
}
return 0;
}
So would that work?
Re: Warning -
Runedog48 - 16.07.2011
Код:
public OnPlayerUpdate(playerid)
{
{
if( PlayerInfo[playerid][Invisible] == 1)
{
SendClientMessage(playerid, COLOUR_WHITE, "Inv" );
return 1;
}
}
return 1;
}
Re: Warning -
cloudysky - 16.07.2011
Quote:
Originally Posted by Runedog48
Код:
public OnPlayerUpdate(playerid)
{
{
if( PlayerInfo[playerid][Invisible] == 1)
{
SendClientMessage(playerid, COLOUR_WHITE, "Inv" );
return 1;
}
}
return 1;
}
|
Thanks for the response but that completely defeats the purpose of me originally posting.
Re: Warning -
Wesley221 - 16.07.2011
pawn Код:
public OnPlayerUpdate(playerid)
{
if ( PlayerInfo[playerid][Invisible] == 1 )
{
// Stuff in here
}
return 0;
}
Re: Warning -
[MG]Dimi - 16.07.2011
Quote:
...so I can become "Invisible" to other players...
|
I guess you have defined what is invisible so just put this:
PHP код:
public OnPlayerUpdate(playerid)
{
PlayerInfo[playerid][Invisible] = 1;
return 0;
}
Re: Warning -
Babul - 16.07.2011
maybe like this?
Код:
public OnPlayerUpdate(playerid)
{
if(PlayerInfo[playerid][Invisible]==1)
{
GameTextForPlayer(playerid,"~l~inv",100,4);
return 0;
}
return 1;
}
Re: Warning -
Kush - 16.07.2011
Quote:
Originally Posted by cloudysky
pawn Код:
public OnPlayerUpdate(playerid) { { if( PlayerInfo[playerid][Invisible] == 1) { SendClientMessage(playerid, COLOUR_WHITE, "Inv" ); } } return 0; }
So would that work?
|
Yes, Wesleys method should work perfectly. What you've done wrong with your original post, is that you have't set a return value for the callback.