SA-MP Forums Archive
Enumerators Variables - 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: Enumerators Variables (/showthread.php?tid=648990)



Enumerators Variables - vikiopp - 31.01.2018

Hi everyone. I want to ask if somebody found any solution how to use enum variables to create table in mysql.
If the enum has pLevel, pMoney etc.. just create table with theese variables. Thanks in advance.


Re: Enumerators Variables - solstice_ - 31.01.2018

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


Re: Enumerators Variables - vikiopp - 31.01.2018

Sorry my mistake for not giving enough details. The problem is that i need to pull all the variables automaticly then create table. I need it to be automated. Not me inserting variables one at a time.


Re: Enumerators Variables - Nizarh - 31.01.2018

Quote:
Originally Posted by vikiopp
Посмотреть сообщение
Hi everyone. I want to ask if somebody found any solution how to use enum variables to create table in mysql.
If the enum has pLevel, pMoney etc.. just create table with theese variables. Thanks in advance.
Before You make a post make sure you search on the forum, because most of the questions are already here.


Re: Enumerators Variables - solstice_ - 31.01.2018

Quote:
Originally Posted by vikiopp
Посмотреть сообщение
Sorry my mistake for not giving enough details. The problem is that i need to pull all the variables automaticly then create table. I need it to be automated. Not me inserting variables one at a time.
So you're saying that you want the script to create all the variables and create a new table when the server starts, right?


Re: Enumerators Variables - vikiopp - 31.01.2018

Quote:
Originally Posted by Nizarh
Посмотреть сообщение
Before You make a post make sure you search on the forum, because most of the questions are already here.
I searched and not found the answer


Re: Enumerators Variables - vikiopp - 31.01.2018

Quote:
Originally Posted by willbedie
Посмотреть сообщение
So you're saying that you want the script to create all the variables and create a new table when the server starts, right?
Well i need to pull the variables from the enum and with them create table.


Re: Enumerators Variables - solstice_ - 31.01.2018

Quote:
Originally Posted by vikiopp
Посмотреть сообщение
Well i need to pull the variables from the enum and with them create table.
PHP код:
public OnGameModeInit()
{
    
SQL::Connect(mysql_hostmysql_usermysql_passmysql_db);
    if(!
SQL::ExistsTable(SQL_PLAYERS_TABLE))
    {
        new 
handle SQL::Open(SQL::CREATESQL_PLAYERS_TABLE); 
        
SQL::AddTableColumn(handle"pKills"SQL_TYPE_INT);
        
SQL::AddTableColumn(handle"pDeaths"SQL_TYPE_INT);
        
SQL::AddTableColumn(handle"pMuted"SQL_TYPE_INT);
        
SQL::AddTableColumn(handle"pSkin"SQL_TYPE_INT);
        
SQL::Close(handle);
    }

That's what i use to create a new table when i start my gamemode, i am using an include called easymysql though. I just posted this as it might be helpful


Re: Enumerators Variables - vikiopp - 31.01.2018

Let me make this easier. Is there any way to print names of the variables from the enum. For creating the table i will work something out.


Re: Enumerators Variables - vikiopp - 01.02.2018

anyone?