Warning
#1

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;
}
Reply
#2

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.
Reply
#3

pawn Код:
public OnPlayerUpdate(playerid)
{
    {
        if( PlayerInfo[playerid][Invisible] == 1)
        {
            SendClientMessage(playerid, COLOUR_WHITE, "Inv" );
        }
    }
    return 0;
}
So would that work?
Reply
#4

Код:
public OnPlayerUpdate(playerid)
{
    {
        if( PlayerInfo[playerid][Invisible] == 1)
        {
            SendClientMessage(playerid, COLOUR_WHITE, "Inv" );
            return 1;
        } 
    }
    return 1;
}
Reply
#5

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.
Reply
#6

pawn Код:
public OnPlayerUpdate(playerid)
{
    if ( PlayerInfo[playerid][Invisible] == 1 )
    {
        // Stuff in here
    }
    return 0;
}
Reply
#7

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;

Reply
#8

maybe like this?
Код:
public OnPlayerUpdate(playerid)
{
	if(PlayerInfo[playerid][Invisible]==1)
	{
		GameTextForPlayer(playerid,"~l~inv",100,4);
		return 0;
	}
	return 1;
}
Reply
#9

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)