SA-MP Forums Archive
Enum being available for gamemode and 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: Enum being available for gamemode and filterscript. (/showthread.php?tid=459311)



Enum being available for gamemode and filterscript. - Magic_Time - 22.08.2013

Hi, I have this enum:

PHP код:
enum pInfo
{
    
Pass,
    
Cash,
    
Admin,
    
Kills,
    
Deaths,
    
Score,
    
Donor,
    
OnDuty
}
new 
PlayerInfo[MAX_PLAYERS][pInfo]; 
I have a filterscript that saves all the information this enum contains, I tried to make a ".inc" file which contains this enum, so I added: "#include <enum> on my filterscript and I added it aswell on my gamemode because I want to be able to read the information on my gamemode aswell.

It compiles fine, but it doesn't work. When for example I change the Admin level on my gamemode, it won't be visible on the filterscript.


-Sorry for my bad english


Re: Enum being available for gamemode and filterscript. - ProjectMan - 22.08.2013

enum is just enum until you assign a value to it. Just remember that.


Re: Enum being available for gamemode and filterscript. - SuperViper - 22.08.2013

Use PVars for cross-script variables.

https://sampwiki.blast.hk/wiki/SetPVarInt


Re: Enum being available for gamemode and filterscript. - Magic_Time - 22.08.2013

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Use PVars for cross-script variables.

https://sampwiki.blast.hk/wiki/SetPVarInt
Hi, thanks for the response..
So? Can I do it like this:

On my filterscript:

Below my OnPlayerDeath:

PHP код:
SetPVarInt(playerid"Deaths"PlayerInfo[playerid][Deaths]); 
My gamemode:

Maybe a textdraw where I want to show the deaths..:

PHP код:
new deaths[playerid] = GetPVarInt(playerid"Deaths"); 
Is that right?


Re: Enum being available for gamemode and filterscript. - Dr.Einstein - 22.08.2013

Quote:
Originally Posted by Magic_Time
Посмотреть сообщение
Hi, thanks for the response..
So? Can I do it like this:

On my filterscript:

Below my OnPlayerDeath:

PHP код:
SetPVarInt(playerid"Deaths"PlayerInfo[playerid][Deaths]); 
My gamemode:

Maybe a textdraw where I want to show the deaths..:

PHP код:
new deaths[playerid] = GetPVarInt(playerid"Deaths"); 
Is that right?
The way I learned how to code was by testing every single function of SAMP on my own. Trying to experiment with everything. Tested what did this certain function return when this or that was changed. Try that sometime, it will really help you out. And yes, that is one way of doing it. And yes, that way would be right. Try testing with CallRemoteFunction... it will help you even more. And here is a suggestion, if possible try to put together in one place. It'll be easier to handle and read.