SA-MP Forums Archive
Read Gamemode variable for filterscript - 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: Read Gamemode variable for filterscript (/showthread.php?tid=558190)



Read Gamemode variable for filterscript - PowerF - 16.01.2015

can i read variable from gamemode for filterscript?


Re: Read Gamemode variable for filterscript - WLSF - 16.01.2015

Yeah, you can use "CallRemoteFunction", to call methods from gamemode that returns the variable value... It sounds like OOP...

Ex:
pawn Код:
//FS
#define PWN::%1(%2) forward %1(%2); public %1(%2)
new value_r = 10;

PWN:: get_val()
{
    return value_r;
}

//GM
public OnGameModeInit()
{
    printf("%d", CallRemoteFunction("get_val", ""));
    return 1;
}



Re: Read Gamemode variable for filterscript - Schneider - 16.01.2015

Or you could use PVars / GVars to store all your player and gamemode-related info.

Tutorial:
https://sampforum.blast.hk/showthread.php?tid=261584


Re: Read Gamemode variable for filterscript - PowerF - 16.01.2015

Quote:
Originally Posted by Willian_Luigi
Посмотреть сообщение
Yeah, you can use "CallRemoteFunction", to call methods from gamemode that returns the variable value... It sounds like OOP...
can you give me an example?
btw,i use GarHouse system.
if player use /myhouse in DM they will get an error message.

pawn Код:
CMD:myhouses(playerid, params[])
{

    #pragma unused params
    if ( PlayerInfo[playerid][inDM] == 1 ) return SendClientMessage( playerid, -1, ""RED"ERROR: "GREY"You Are in DM
    if(GetOwnedHouses(playerid) == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NO_HOUSES_OWNED);
    new h, _tmpstring[128], count = GetOwnedHouses(playerid);
    CMDSString = "
";
    Loop(i, (count + 1), 1)
    {
        h = ReturnPlayerHouseID(playerid, i);
        if(i == count)
        {
            format(_tmpstring, sizeof(_tmpstring), "
{00BC00}%d.\t{FFFF2A}%s in %s", i, hInfo[h][HouseName], hInfo[h][HouseLocation]);
        }
        else format(_tmpstring, sizeof(_tmpstring), "
{00BC00}%d.\t{FFFF2A}%s in %s\n", i, hInfo[h][HouseName], hInfo[h][HouseLocation]);
        strcat(CMDSString, _tmpstring);
    }
    ShowPlayerDialog(playerid, HOUSEMENU+50, DIALOG_STYLE_LIST, INFORMATION_HEADER, CMDSString, "
Select", "Cancel");
    return 1;
}