M1KE 7 Odesláno: 1. Duben, 2018 Share Odesláno: 1. Duben, 2018 čau lidi začínám vytvářet server a potřeboval by jsem poradit jak udělat/kde sehnat registraci a ukládání informací o hráčích (peníze,wl,pozice,skin).Nejlepší by byl už nějaký udělaný script protože s pawnem moc neumím Předem díky za rady a tipy. Link to comment Share on other sites More sharing options...
1 Guyy 14 Odesláno: 1. Duben, 2018 Share Odesláno: 1. Duben, 2018 (upraveno) Preto ti to dá 0, lebo pošleš mu peniaze z premennej, ktorá sa rovna nule, a potom ju nastavíš na hodnotu zo súboru, nastavovanie penazí v logine môžeš dať tak, že si hodnotu vyčíta priamo zo súboru (jednoduhšie) GivePlayerMoney(playerid, DOF2_GetInt(file, "Money")); Alebo zoradiť aby nastavilo peniaze až po zapísaní hodnoty zo súboru PlayerInfo[playerid][pMoney] = DOF2_GetInt(file,"Money"); GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]); Edited 1. Duben, 2018 by Guyy Link to comment Share on other sites More sharing options...
0 Smexy 5 Odesláno: 1. Duben, 2018 Share Odesláno: 1. Duben, 2018 (upraveno) Citace Nejlepší by byl už nějaký udělaný script Hm, to asi nebude úplně tvůj server, že? Ale těch, od nichž si ten script "vypůjčíš"*. Abys neřekl, že jsem ti nic nedal. http://forum.sa-mp.com/showthread.php?t=281736, první odkaz na Googlu. Pro příště ho můžeš zkusit taky použít, je to chytrý nástroj. (y) *"vypůjčíš" = vezmeš, čórneš, ukradneš,... Neber to nijak ofenzivně. To, co jsem ti poslal je tutorial, takže si ho snad alespoň trochu pozměníš, tím se nemyslí jen přeložíš. Edited 1. Duben, 2018 by Smexy Link to comment Share on other sites More sharing options...
0 M1KE 7 Odesláno: 1. Duben, 2018 Author Share Odesláno: 1. Duben, 2018 Ten Script od toho týpka mi nějak nefunguje. Přesněji když na serveru vydělám nějaký peníze tak se to ve složce s Učty nepřepíše a když to přepíšu tak mi to dá dvojnásobek toho čísla. Nevíte někdo co s tím ? Link to comment Share on other sites More sharing options...
0 Smexy 5 Odesláno: 1. Duben, 2018 Share Odesláno: 1. Duben, 2018 Pošli sem svůj kod. Nechce se mi to hledat v deseti kodech, když to lze z jednoho. Link to comment Share on other sites More sharing options...
0 M1KE 7 Odesláno: 1. Duben, 2018 Author Share Odesláno: 1. Duben, 2018 #include <a_samp> #include <Double-O-Files_2> #define DIALOG_REGISTER 1111 #define DIALOG_LOGIN 2222 enum pInfo { pKills, pDeaths, pMoney, pAdmin } new PlayerInfo[MAX_PLAYERS][pInfo]; //---------------------- public OnFilterScriptInit() { printf("Registration System DOF2 by Jafet Macario loaded"); return 1; } public OnFilterScriptExit() { DOF2_Exit(); return 1; } public OnPlayerRequestClass(playerid, classid) { return 1; } public OnPlayerConnect(playerid) { new file[64]; GetPlayerName(playerid,file,sizeof(file)); format(file,sizeof(file),DOF2_File(file));// Here we get the path from DOF2_File (/Users) if(DOF2_FileExists(file)) // We check if the player is registered { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Welcome.Please log-in","{FFFFFF}Type your {00FF22}password {FFFFFF}here to log-in","Log-in","Quit"); } else // If not registered { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Please register!","{FFFFFF}Type your {00FF22}password {FFFFFF}here to register.","Register","Quit"); } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_REGISTER) // If dialog_register (id 1) shows up { if(!response) Kick(playerid); // If he click on Quit, he will get kicked if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Please register!","{FFFFFF}Type your {00FF22}password {FFFFFF}here to register.","Register","Quit"); // If he doesn't type anything, the dialog will show again. if(response) // If he click on Register { new file[64]; // We declare the size of the file GetPlayerName(playerid,file,sizeof(file)); // We get the file name format(file,sizeof(file),DOF2_File(file)); // We get the path name from DOF2_File, that means from Users folder. DOF2_CreateFile(file, inputtext); // Creates the file and the password. DOF2_SetInt(file, "Kills",PlayerInfo[playerid][pKills] = 0); // When the player register his kills will be set to 0, you can change DOF2_SetInt(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0); // His deaths will be set to 0, you can change DOF2_SetInt(file, "Money",PlayerInfo[playerid][pMoney] = 1000); // His money will be set to 1000, you can change DOF2_SetInt(file, "AdminLevel",PlayerInfo[playerid][pAdmin] = 0); // His Admin Level will be set to 0, you can change DOF2_SaveFile(); // Saves the file. SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0); // Sets where the player will spawn, this coordinates are from the Unity Station in Los Santos SpawnPlayer(playerid); // After registering, the player will spawn. } } if(dialogid == DIALOG_LOGIN) // If dialog_login (id 2) shows up { if(!response) Kick(playerid); // If he click on Quit, he will get kicked. if(response) // If he click on Log-in { new file[64]; // We declare the size of the file GetPlayerName(playerid,file,sizeof(file)); // We get the file name format(file,sizeof(file),DOF2_File(file)); // We get the user path from DOF2_File ( folder Users ) if(DOF2_FileExists(file)) // If he is registered { if(DOF2_CheckLogin(file,inputtext)) // We check if the password match { PlayerInfo[playerid][pKills] = DOF2_GetInt(file,"Kills"); // We load our settings PlayerInfo[playerid][pDeaths] = DOF2_GetInt(file,"Deaths"); PlayerInfo[playerid][pMoney] = DOF2_GetInt(file,"Money"); PlayerInfo[playerid][pAdmin] = DOF2_GetInt(file,"AdminLevel"); SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0); // We set the spawn (Unity Station) SpawnPlayer(playerid); // The player spawns after log-in return 1; } else // If the password don't match, they will get an error { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Wrong Password!","{F81414}You have typed a wrong password\n{FFFFFF}Type your password here to log-in!","Log-in","Quit"); return 1; } } } } return 1; } public OnPlayerDisconnect(playerid, reason) { new file[64]; // We declare the size of the file GetPlayerName(playerid,file,sizeof(file)); // We get the file name format(file,sizeof(file),DOF2_File(file));// We get the user path from DOF2_File (folder Users) DOF2_SetInt(file, "Kills",PlayerInfo[playerid][pKills]); // We set/update the players settings. DOF2_SetInt(file, "Deaths",PlayerInfo[playerid][pDeaths]); DOF2_SetInt(file, "Money",PlayerInfo[playerid][pMoney]); DOF2_SetInt(file, "AdminLevel",PlayerInfo[playerid][pAdmin]); return 1; } public OnPlayerSpawn(playerid) { GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]); return 1; } public OnPlayerDeath(playerid, killerid, reason) { PlayerInfo[killerid][pKills]++; PlayerInfo[playerid][pDeaths]++; return 1; } Link to comment Share on other sites More sharing options...
0 Guyy 14 Odesláno: 1. Duben, 2018 Share Odesláno: 1. Duben, 2018 Nastavovanie penazí daj do dialógu prihlásenia.. Lebo po každom spawnutí ti to pridá peniaze ktoré ma nastavené, a zo Spawnu nastavovanie vymaž.. Peniaze ti to neuloží preto, lebo ty ukládaš peniaze s premennej, ale pridávaš si ich defaultne (GivePlayerMoney) že je tak.. V ukládaní prepíš DOF2_SetInt(file, "Money", PlayerInfo[playerid][pMoney]) na GetPlayerMoney(playerid).. Link to comment Share on other sites More sharing options...
0 M1KE 7 Odesláno: 1. Duben, 2018 Author Share Odesláno: 1. Duben, 2018 Mrkni jestli jsem to udělal správně protože teď už to dělá něco jinýho jednou se připojím načte to 5000 a když dám relog tak mám zase 0 potom dám znovu relog a zase 5000 nechápu to #include <a_samp> #include <Double-O-Files_2> #define DIALOG_REGISTER 1111 #define DIALOG_LOGIN 2222 enum pInfo { pKills, pDeaths, pMoney, pAdmin } new PlayerInfo[MAX_PLAYERS][pInfo]; //---------------------- public OnFilterScriptInit() { printf("Registration System DOF2 by Jafet Macario loaded"); return 1; } public OnFilterScriptExit() { DOF2_Exit(); return 1; } public OnPlayerRequestClass(playerid, classid) { return 1; } public OnPlayerConnect(playerid) { new file[64]; GetPlayerName(playerid,file,sizeof(file)); format(file,sizeof(file),DOF2_File(file));// Here we get the path from DOF2_File (/Users) if(DOF2_FileExists(file)) // We check if the player is registered { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Welcome.Please log-in","{FFFFFF}Type your {00FF22}password {FFFFFF}here to log-in","Log-in","Quit"); } else // If not registered { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Please register!","{FFFFFF}Type your {00FF22}password {FFFFFF}here to register.","Register","Quit"); } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_REGISTER) // If dialog_register (id 1) shows up { if(!response) Kick(playerid); // If he click on Quit, he will get kicked if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Please register!","{FFFFFF}Type your {00FF22}password {FFFFFF}here to register.","Register","Quit"); // If he doesn't type anything, the dialog will show again. if(response) // If he click on Register { new file[64]; // We declare the size of the file GetPlayerName(playerid,file,sizeof(file)); // We get the file name format(file,sizeof(file),DOF2_File(file)); // We get the path name from DOF2_File, that means from Users folder. DOF2_CreateFile(file, inputtext); // Creates the file and the password. DOF2_SetInt(file, "Kills",PlayerInfo[playerid][pKills] = 0); // When the player register his kills will be set to 0, you can change DOF2_SetInt(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0); // His deaths will be set to 0, you can change DOF2_SetInt(file, "Money",PlayerInfo[playerid][pMoney] = 1000); // His money will be set to 1000, you can change DOF2_SetInt(file, "AdminLevel",PlayerInfo[playerid][pAdmin] = 0); // His Admin Level will be set to 0, you can change DOF2_SaveFile(); // Saves the file. SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0); // Sets where the player will spawn, this coordinates are from the Unity Station in Los Santos SpawnPlayer(playerid); // After registering, the player will spawn. } } if(dialogid == DIALOG_LOGIN) // If dialog_login (id 2) shows up { if(!response) Kick(playerid); // If he click on Quit, he will get kicked. if(response) // If he click on Log-in { new file[64]; // We declare the size of the file GetPlayerName(playerid,file,sizeof(file)); // We get the file name format(file,sizeof(file),DOF2_File(file)); // We get the user path from DOF2_File ( folder Users ) if(DOF2_FileExists(file)) // If he is registered { if(DOF2_CheckLogin(file,inputtext)) // We check if the password match { GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]); PlayerInfo[playerid][pKills] = DOF2_GetInt(file,"Kills"); // We load our settings PlayerInfo[playerid][pDeaths] = DOF2_GetInt(file,"Deaths"); PlayerInfo[playerid][pMoney] = DOF2_GetInt(file,"Money"); PlayerInfo[playerid][pAdmin] = DOF2_GetInt(file,"AdminLevel"); SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0); // We set the spawn (Unity Station) SpawnPlayer(playerid); // The player spawns after log-in return 1; } else // If the password don't match, they will get an error { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Wrong Password!","{F81414}You have typed a wrong password\n{FFFFFF}Type your password here to log-in!","Log-in","Quit"); return 1; } } } } return 1; } public OnPlayerDisconnect(playerid, reason) { new file[64]; // We declare the size of the file GetPlayerName(playerid,file,sizeof(file)); // We get the file name format(file,sizeof(file),DOF2_File(file));// We get the user path from DOF2_File (folder Users) DOF2_SetInt(file, "Kills",PlayerInfo[playerid][pKills]); // We set/update the players settings. DOF2_SetInt(file, "Deaths",PlayerInfo[playerid][pDeaths]); DOF2_SetInt(file, "Money",GetPlayerMoney(playerid)); DOF2_SetInt(file, "AdminLevel",PlayerInfo[playerid][pAdmin]); return 1; } public OnPlayerDeath(playerid, killerid, reason) { PlayerInfo[killerid][pKills]++; PlayerInfo[playerid][pDeaths]++; return 1; } Link to comment Share on other sites More sharing options...
0 M1KE 7 Odesláno: 1. Duben, 2018 Author Share Odesláno: 1. Duben, 2018 (upraveno) Super už to funguje díky moc Edited 1. Duben, 2018 by RiciGO 420 Link to comment Share on other sites More sharing options...
0 M1KE 7 Odesláno: 1. Duben, 2018 Author Share Odesláno: 1. Duben, 2018 Ještě by jsem potřeboval poradit s tím jak udělat aby se ukládal skin Link to comment Share on other sites More sharing options...
0 Guyy 14 Odesláno: 2. Duben, 2018 Share Odesláno: 2. Duben, 2018 // Uloženie DOF2_SetInt(file, "Skin", GetPlayerSkin(playerid)); // Načítanie SetPlayerSkin(playerid, DOF2_GetInt(file, "Skin")); Niesom si istý či funkcia GetPlayerSkin existuje, pokiaľ nie tak ID skinu ukladaj do premennej PlayerInfo[playerid][pSkin] a načítaj ju presne tak isto ako peniaze.. Link to comment Share on other sites More sharing options...
Dotaz
M1KE 7
čau lidi začínám vytvářet server a potřeboval by jsem poradit jak udělat/kde sehnat registraci a ukládání informací o hráčích (peníze,wl,pozice,skin).Nejlepší by byl už nějaký udělaný script protože s pawnem moc neumím Předem díky za rady a tipy.
Link to comment
Share on other sites
10 odpovědí na tuto otázku
Recommended Posts