enum PlayerData - Can be used globally in multiple scripts ?
#1

Hello!

I am using LuxAdmin V 1.6 and i need to disable god(mode) inside my gamemode. The problem is this lines, which is located in the LuxAdmin, i cant make them usable in my Gamemode. How can i do that?:

pawn Code:
enum PlayerData
{
    Registered,
    LoggedIn,
    pVip,
    Level,
    Muted,
    SpamCount,
    MaxAdv,
    #if EnableTwoRcon == true
    MaxRcon,
    #endif
    SpamTime,
    Caps,
    Kills,
    Deaths,
    God,
    Spawned,
    TimesSpawned,
    hours,
    mins,
    secs,
    MuteWarnings,
    Warnings,
    TotalTime,
    ConnectTime,
    GodCar,
    pColour,
    pCar,
    DoorsLocked,
    Frozen,
    FreezeTime,
    PingTime,
    PingCount,
    pPing[PING_MAX_EXCEEDS],
    BotPing,
    Hide,
    OnDuty,
    Jailed,
    JailTime,
    blipS,
    blip,
    SpecType,
    SpecID,
    FailLogin,
    bool:AllowedIn,
    pCaged,
    pInvis,
    pCageTime,
    pGps,
    NoQuestion,
    #if EnableCamHack == true
    InCamMod,
    LockedCam,
    #endif
};
I was thinking of PVars, but i dont know if thats possible :/

Any help is appreciated! Thanks a lot!
Reply
#2

Yes, PVars can be used throught different filterscripts/gamemodes and you should use them becuse they are faster to
These enums that you are using at the moment are only usable within your gamemode(or if it's a filterscript) but they are only usable in the one they are defined in.

Hope it helped
Reply
#3

make a public function:
public SetBlabla(playerid, value)
{
//Set playerid's blabla to value
}

In the filterscript use
CallRemoteFunction("SetBlabla", "dd", playerid, value);
Reply
#4

No they are not usable in other script
since they are not in the script.

SetPVarInt
SetPVarFloat

are usable in any scripts..
Reply
#5

Quote:
Originally Posted by Ranama
View Post
Yes, PVars can be used throught different filterscripts/gamemodes and you should use them becuse they are faster to
These enums that you are using at the moment are only usable within your gamemode(or if it's a filterscript) but they are only usable in the one they are defined in.

Hope it helped
So, can i be able to change out an Enum with a pVar ? I dont know what enums does lol xD
Reply
#6

Yes, enums is used to store data, like
Code:
playerinfo[playerid][money] = 10000;
            INDEX     NAME      (Giving it a value)
that means that you give 10k money to a player, you can do that with pvars instead, check out this:
https://sampwiki.blast.hk/wiki/Per-player_variable_system
Reply
#7

Quote:
Originally Posted by Ranama
View Post
Yes, PVars can be used throught different filterscripts/gamemodes and you should use them becuse they are faster to
These enums that you are using at the moment are only usable within your gamemode(or if it's a filterscript) but they are only usable in the one they are defined in.

Hope it helped
They aren't faster
Reply
#8

Quote:
Originally Posted by [ABK]Antonio
View Post
They aren't faster
yes they are, check this out https://sampforum.blast.hk/showthread.php?tid=151076
Reply
#9

I think you are trying, for example, to limit a command that is in a filer script to admin level 2 for example.

Than, yes, you can put the enum in the filter script, with same variables as LuxAdmin, so than you can limit it in the filter script.

Example:

pawn Code:
//In GM you have:
enum pInfo
{
    AdminLevel,
}
new PlayerInfo[MAX_PLAYERS][pInfo];

//Than you make a cmd only for admins:

CMD:hi(playerid, params[])
{
    if(PlayrINfo[playerid][AdminLevel] < 2) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not admin level 2.");
    SendClientMessage(playerid, 0xFFFFFFFF, "Hiiiiiiiiiiii");
    return 1;
}


//Than, you can make this in the filer script too...

enum pInfo
{
    AdminLevel,
}
new PlayerInfo[MAX_PLAYERS][pInfo];


CMD:hoiiii(playerid, params[])
{
    if(PlayrINfo[playerid][AdminLevel] < 2) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not admin level 2.");
    SendClientMessage(playerid, 0xFFFFFFFF, "Hoiiiiiiii");
    return 1;
}


//It's exactly same thing.
Reply
#10

Guys, my question is:

Can i use enums Globally, which i mentioned in my first post?

IF no;

how can I use them globally (in multiple scripts). Can i convert them to Pvars ?
Reply
#11

Did you just ignore everything we said? You can't share the enum, but you can still USE the enum remotely (and that's actually better from an architecture point of view).
Reply
#12

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
Did you just ignore everything we said? You can't share the enum, but you can still USE the enum remotely (and that's actually better from an architecture point of view).
Terribly sorry about that, i am just not so good understanding everything yet. But ill try, and post here if i need help then

Thanks Y_Less
Reply
#13

@Y_less:

I got a fatal error, because you gave me codes with Linux backslash "\". But thats fixed, and now, i get those simple errors:

Код:
C:\Users\simla190995\Documents\SAMP\pawno\include\YSI/y_master.inc(133) : error 017: undefined symbol "_inc_y_master"
C:\Users\simla190995\Documents\SAMP\pawno\include\YSI/y_master.inc(133) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
In My Luxadmin i pasted what u gave me. I haven't gone so far where i can put anything in my GM yet.

Thanks
Reply
#14

Backslash is Windows and correct, forwardslash is Linux and wrong.
Reply
#15

Please read it again. I fixed taht, any ideas what the next problem can be? the errors?
Reply
#16

I don't know, what are the new errors using the correct slashes? That message still shows the wrong ones.
Reply
#17

Fixed, thanks for help, i know how to do the rest now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)