SA-MP Forums Archive
Set a variable to true with Call Remote Function - 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)
+--- Thread: Set a variable to true with Call Remote Function (/showthread.php?tid=523766)



Set a variable to true with Call Remote Function - YwX - 03.07.2014

Hello all!
Well, I've searched and not found anything.
I have a boolean in one script, and I want to set it true in another script, using Call Remote Function:
pawn Код:
new bool: logged[MAX_PLAYERS];

forward LoggedCall(playerid);
public LoggedCall(playerid)
{
       return logged[playerid];
}

//In another script, I need to turn on this boolean
CallRemoteFunction("LoggedCall", "i", playerid) = true;
But it isn't working, I get an error in this line:
pawn Код:
error 022: must be lvalue (non-constant)
How to fix this?
Thanks all in advance!


Re: Set a variable to true with Call Remote Function - greentarch - 03.07.2014

Quote:
Originally Posted by YwX
Посмотреть сообщение
Hello all!
Well, I've searched and not found anything.
I have a boolean in one script, and I want to set it true in another script, using Call Remote Function:
pawn Код:
new bool: logged[MAX_PLAYERS];

forward LoggedCall(playerid);
public LoggedCall(playerid)
{
       return logged[playerid];
}

//In another script, I need to turn on this boolean
CallRemoteFunction("LoggedCall", "i", playerid) = true;
But it isn't working, I get an error in this line:
pawn Код:
error 022: must be lvalue (non-constant)
How to fix this?
Thanks all in advance!
Try this.
pawn Код:
new
    logged[ playerid ];

forward LoggedCall( playerid, condition );
public LoggedCall( playerid, condition )
    return logged[ playerid ] = condition;

// In another script
CallRemoteFunction( "LoggedCall", "ii", playerid, condition );
NOTE: No booleans, it's set default as an integer.