· 5 years ago · Mar 27, 2020, 08:04 PM
1CreateFileDB()
2{
3 mysql_tquery(getConexao(), "CREATE TABLE IF NOT EXISTS `usuarios`(\
4 `ID` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,\
5 `Name` varchar(24) NOT NULL,\
6 `Password` varchar(20) NOT NULL,\
7 `Level` int(10) NOT NULL DEFAULT '0',\
8 `Jailed` int(20) NOT NULL DEFAULT '0',\
9 `JailedAdmin` int(20) NOT NULL DEFAULT '0',\
10 `Wanted` int(20) NOT NULL DEFAULT '0',\
11 `Bans` int(20) NOT NULL DEFAULT '0',\
12 `BanTime` int(20) NOT NULL DEFAULT '0',\
13 `GanhouCorridas` int(20) NOT NUL DEFAULT '0',\
14 `TruckerLicense` int(11) NOT NULL DEFAULT '0',\
15 `MafiaLicense` int(11) NOT NULL DEFAULT '0',\
16 `BusLicense` int(20) NOT NUL DEFAULT '0',\
17 `WeaponLicense` int(20) NOT NUL DEFAULT '0',\
18 `TaxiLicense` int(20) NOT NUL DEFAULT '0',\
19 `CarroLicense` int(20) NOT NUL DEFAULT '0',\
20 `LoginDias` int(20) NOT NUL DEFAULT '0',\
21 `LoginMes` int(20) NOT NUL DEFAULT '0',\
22 `LoginAno` int(20) NOT NUL DEFAULT '0',\
23 `StatusAdvogado` int(20) NOT NUL DEFAULT '0',\
24 `Muted` int(20) NOT NUL DEFAULT '0',\
25 `RulesRead` varchar(20) NOT NULL,\
26 `StatsMetersDriven` float(20) NOT NULL DEFAULT 0.0,\
27 `StatsTruckerJobs` int(20) NOT NUL DEFAULT '0',\
28 `StatsConvoyJobs` int(20) NOT NUL DEFAULT '0',\
29 `StatsQuadrilhaJobs` int(20) NOT NUL DEFAULT '0',\
30 `StatsBusDriverJobs` int(20) NOT NUL DEFAULT '0',\
31 `StatsVigilante` int(20) NOT NUL DEFAULT '0',\
32 `StatsTaxiDriverJobs` int(20) NOT NUL DEFAULT '0',\
33 `StatsPilotJobs` int(20) NOT NUL DEFAULT '0',\
34 `StatsMafiaJobs` int(20) NOT NUL DEFAULT '0',\
35 `StatsMafiaStolen` int(20) NOT NUL DEFAULT '0',\
36 `StatsPoliceFined` int(20) NOT NUL DEFAULT '0',\
37 `StatsPoliceJailed` int(20) NOT NUL DEFAULT '0',\
38 `StatsAssistance` int(20) NOT NUL DEFAULT '0',\
39 `StatsCourierJobs` int(20) NOT NUL DEFAULT '0',\
40 `StatsRoadworkerJobs` int(20) NOT NUL DEFAULT '0',\
41 `StatsPizzaJobs` int(20) NOT NUL DEFAULT '0',\
42 `StatsCourierJobs` int(20) NOT NUL DEFAULT '0',\
43 `House0` int(20) NOT NUL DEFAULT '0',\
44 `House1` int(20) NOT NUL DEFAULT '0',\
45 `House2` int(20) NOT NUL DEFAULT '0',\
46 `House3` int(20) NOT NUL DEFAULT '0',\
47 `House4` int(20) NOT NUL DEFAULT '0',\
48 `House5` int(20) NOT NUL DEFAULT '0',\
49 `House6` int(20) NOT NUL DEFAULT '0',\
50 `House7` int(20) NOT NUL DEFAULT '0',\
51 `House8` int(20) NOT NUL DEFAULT '0',\
52 `House9` int(20) NOT NUL DEFAULT '0',\
53 `Business0` int(20) NOT NUL DEFAULT '0',\
54 `Business1` int(20) NOT NUL DEFAULT '0',\
55 `Business2` int(20) NOT NUL DEFAULT '0',\
56 `Business3` int(20) NOT NUL DEFAULT '0',\
57 `Business4` int(20) NOT NUL DEFAULT '0',\
58 `Business5` int(20) NOT NUL DEFAULT '0',\
59 `Money` int(20) NOT NUL DEFAULT '0',\
60 `Score` int(20) NOT NUL DEFAULT '0',\
61 `Sexo` int(20) NOT NULL\
62 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
63}
64
65
66CreatePlayerFileDB(playerid)
67{
68 new Query[500*2], name[MAX_PLAYER_NAME], rows = mysql_num_rows();;
69 GetPlayerName(playerid, name, MAX_PLAYER_NAME+2);
70 mysql_format(getConexao(), Query, sizeof(Query), "SELECT * FROM `usuarios` where `Name` = '%s'", name);
71 mysql_query(getConexao());
72
73 if(rows == 0) {
74 new muted[12], read[12], teste[50];
75 if(APlayerData[playerid][Muted] == true) { format(muted, 12, "Yes"); } else { format(muted, 12, "No"); }
76 if(APlayerData[playerid][RulesRead] == true) { format(read, 12, "Yes"); } else { format(read, 12, "No"); }
77 mysql_format(getConexao(), Query, sizeof(Query), "INSERT INTO `usuarios` VALUES('NULL', '%s', '%s', '%d', '%d', '%d', '%d', '%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d', '%s','%s', '%s', '%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d', '%d');",
78 name, APlayerData[playerid][PlayerPassword], APlayerData[playerid][PlayerLevel], APlayerData[playerid][PlayerJailed], APlayerData[playerid][JailedByAdmin], GetPlayerWantedLevel(playerid), APlayerData[playerid][Bans], APlayerData[playerid][BanTime], APlayerData[playerid][GanhouCorridas], APlayerData[playerid][TruckerLicense], APlayerData[playerid][MafiaLicense], APlayerData[playerid][BusLicense],
79 APlayerData[playerid][WeaponLicense], APlayerData[playerid][TaxiLicense], APlayerData[playerid][CarroLicense], APlayerData[playerid][LoginDias], APlayerData[playerid][LoginMes], APlayerData[playerid][LoginAno], APlayerData[playerid][StatusAdvogado], muted, read, APlayerData[playerid][StatsMetersDriven], APlayerData[playerid][StatsTruckerJobs],
80 APlayerData[playerid][StatsConvoyJobs], APlayerData[playerid][StatsQuadrilhaJobs], APlayerData[playerid][StatsBusDriverJobs], APlayerData[playerid][StatsVigilante], APlayerData[playerid][StatsTaxiDriverJobs], APlayerData[playerid][StatsPilotJobs], APlayerData[playerid][StatsMafiaJobs], APlayerData[playerid][StatsMafiaStolen],
81 APlayerData[playerid][StatsPoliceFined],APlayerData[playerid][StatsPoliceJailed], APlayerData[playerid][StatsAssistance], APlayerData[playerid][StatsCourierJobs], APlayerData[playerid][StatsRoadworkerJobs], APlayerData[playerid][StatsPizzaJobs], APlayerData[playerid][Houses][0], APlayerData[playerid][Houses][1],
82 APlayerData[playerid][Houses][2], APlayerData[playerid][Houses][3], APlayerData[playerid][Houses][4], APlayerData[playerid][Houses][5], APlayerData[playerid][Houses][6], APlayerData[playerid][Houses][7], APlayerData[playerid][Houses][8], APlayerData[playerid][Houses][9], APlayerData[playerid][Business][0],
83 APlayerData[playerid][Business][1], APlayerData[playerid][Business][2], APlayerData[playerid][Business][3], APlayerData[playerid][Business][4], APlayerData[playerid][Business][5], APlayerData[playerid][PlayerMoney], APlayerData[playerid][PlayerScore], APlayerData[playerid][Sexo]);
84 mysql_query(Query);
85 SendClientMessage(playerid, -1, "Um novo registro {FF6600}My{3300FF}SQL {FFFFFF}foi criado com sucesso!");
86 format(teste, sizeof(teste), "DEBUG: User: %s", name);
87 SendClientMessage(playerid, -1, teste);
88 }
89 return true;
90}