Enum being available for gamemode and filterscript.
#1

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

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

Use PVars for cross-script variables.

https://sampwiki.blast.hk/wiki/SetPVarInt
Reply
#4

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?
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)