SHOW:
|
|
- or go back to the newest paste.
| 1 | main( ) { }
| |
| 2 | #include <a_samp> | |
| 3 | #include <dutils> | |
| 4 | #include <streamer> | |
| 5 | #include <dini> | |
| 6 | #pragma unused ret_memcpy | |
| 7 | //****************************************************************************** | |
| 8 | // Define-uri | |
| 9 | //****************************************************************************** | |
| 10 | #define COLOR_WHITE 0xFFFFFFFF | |
| 11 | #define DIALOG_REGISTER ( 1 ) | |
| 12 | #define DIALOG_LOGIN ( 2 ) | |
| 13 | #define DIALOG_SEX ( 3 ) | |
| 14 | #define DIALOG_SPAWN ( 4 ) | |
| 15 | #define DIALOG_VARSTA ( 5 ) | |
| 16 | #define DIALOG_FULLNAME ( 6 ) | |
| 17 | ||
| 18 | //****************************************************************************** | |
| 19 | // | |
| 20 | //****************************************************************************** | |
| 21 | //****************************************************************************** | |
| 22 | // Forward-uri | |
| 23 | //****************************************************************************** | |
| 24 | forward OnPlayerRegister(playerid, Parola[]); | |
| 25 | forward SetPlayerSpawn(playerid); | |
| 26 | //****************************************************************************** | |
| 27 | // | |
| 28 | //****************************************************************************** | |
| 29 | ||
| 30 | enum pInfo | |
| 31 | {
| |
| 32 | Parola, | |
| 33 | pAdmin, | |
| 34 | pMoney, | |
| 35 | pLevel, | |
| 36 | pSex, | |
| 37 | pSpawn, | |
| 38 | pVarsta, | |
| 39 | pFullName, | |
| 40 | pInt | |
| 41 | }; | |
| 42 | new PlayerInfo[MAX_PLAYERS][pInfo]; | |
| 43 | ||
| 44 | public SetPlayerSpawn(playerid) | |
| 45 | {
| |
| 46 | if(PlayerInfo[playerid][pSpawn] == 1)//LS | |
| 47 | {
| |
| 48 | SetPlayerPos(playerid,1743.054931,-1861.227294,13.577773); | |
| 49 | SetPlayerFacingAngle(playerid, 0); | |
| 50 | SetPlayerInterior(playerid,0); | |
| 51 | PlayerInfo[playerid][pInt] = 0; | |
| 52 | } | |
| 53 | else if(PlayerInfo[playerid][pSpawn] == 2)//SF | |
| 54 | {
| |
| 55 | SetPlayerPos(playerid,-1983.503540,137.988937,27.687500); | |
| 56 | SetPlayerFacingAngle(playerid, 90); | |
| 57 | SetPlayerInterior(playerid,0); | |
| 58 | PlayerInfo[playerid][pInt] = 0; | |
| 59 | } | |
| 60 | else if(PlayerInfo[playerid][pSpawn] == 3)//LV | |
| 61 | {
| |
| 62 | SetPlayerPos(playerid,1932.8171,1345.1152,9.9688); | |
| 63 | - | SetPlayerFacingAngle(playerid, -90); |
| 63 | + | SetPlayerFacingAngle(playerid, -90); |
| 64 | - | SetPlayerInterior(playerid,0); |
| 64 | + | SetPlayerInterior(playerid,0); |
| 65 | - | PlayerInfo[playerid][pInt] = 0; |
| 65 | + | PlayerInfo[playerid][pInt] = 0; |
| 66 | } | |
| 67 | } | |
| 68 | ||
| 69 | public OnPlayerConnect(playerid) | |
| 70 | {
| |
| 71 | - | new name[MAX_PLAYERS], file[128]; // name - numele lui , file - fisierul lui! |
| 71 | + | new name[MAX_PLAYERS], file[128]; |
| 72 | - | GetPlayerName(playerid, name, MAX_PLAYERS); // ii va verifica numele daca este inregistrat |
| 72 | + | GetPlayerName(playerid, name, MAX_PLAYERS); |
| 73 | - | format(file, sizeof(file), "Users/%s.ini", name); // locul unde se inregistreaza |
| 73 | + | format(file, sizeof(file), "Users/%s.ini", name); |
| 74 | - | if(!fexist(file)) { // daca nu este inregistrat ii va trimite mesaj
|
| 74 | + | if(!fexist(file)) {
|
| 75 | SendClientMessage(playerid, 0xAA3333AA, "Nu esti inregistrat te rog inregistreaza-te!"); | |
| 76 | ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Inregistreaza-te te rog!", "Introdu parola ", "Register", "Iesi"); | |
| 77 | } | |
| 78 | else{
| |
| 79 | - | new str[128]; // dar daca playerul este deja inregistrat il va pune sa se logheze! |
| 79 | + | new str[128]; |
| 80 | - | GetPlayerName(playerid, name, MAX_PLAYERS); // ii verifica numele |
| 80 | + | GetPlayerName(playerid, name, MAX_PLAYERS); |
| 81 | - | format(str, sizeof(str), "Bine ai venit inapoi pe server ~r~%s. Distreaza-te!", name); // Va primi un mesaj de bun venit inapoi! |
| 81 | + | format(str, sizeof(str), "Bine ai venit inapoi pe server ~r~%s. Distreaza-te!", name); |
| 82 | SendClientMessage(playerid, 0xAA3333AA, str); | |
| 83 | ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Te rugam logheaza-te", "Introdu parola", "Login", "Cancel"); | |
| 84 | } | |
| 85 | return 1; | |
| 86 | } | |
| 87 | ||
| 88 | public OnPlayerDisconnect(playerid, reason) | |
| 89 | {
| |
| 90 | - | new file[128], name[MAX_PLAYERS]; // noul fisier ce se va crea daca nu este inregistrat! |
| 90 | + | new file[128], name[MAX_PLAYERS]; |
| 91 | - | GetPlayerName(playerid, name, MAX_PLAYERS); // ii va detecta numele! |
| 91 | + | GetPlayerName(playerid, name, MAX_PLAYERS); |
| 92 | - | format(file, sizeof(file), "Users/%s.ini", name); // iar aici i se va salva puteti modifica cum vreti voi! |
| 92 | + | format(file, sizeof(file), "Users/%s.ini", name); |
| 93 | - | if(dini_Exists(file)) { // Iar acum pur si simplu cu dini_IntSet vom salva ce am enumerat noi mai sus!
|
| 93 | + | if(dini_Exists(file)) {
|
| 94 | dini_IntSet(file, "Parola", PlayerInfo[playerid][Parola]); | |
| 95 | dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][pAdmin]); | |
| 96 | dini_IntSet(file, "Bani", PlayerInfo[playerid][pMoney]); | |
| 97 | dini_IntSet(file, "Level", PlayerInfo[playerid][pLevel]); | |
| 98 | dini_IntSet(file, "Sex", PlayerInfo[playerid][pSex]); | |
| 99 | dini_IntSet(file, "Spawn", PlayerInfo[playerid][pSpawn]); | |
| 100 | dini_IntSet(file, "Varsta", PlayerInfo[playerid][pVarsta]); | |
| 101 | } | |
| 102 | - | return 1; // Si asta e tot am reusit sa salvam contul jucatorului // |
| 102 | + | |
| 103 | } | |
| 104 | ||
| 105 | public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) | |
| 106 | {
| |
| 107 | - | if(dialogid == DIALOG_REGISTER) { // Primul dialog cu id 1 este acel in care jucatorul isi introduce parola pentru a se inregistra !
|
| 107 | + | if(dialogid == DIALOG_REGISTER) {
|
| 108 | - | new file[128], name[MAX_PLAYERS], str[128]; // ii va crea un fiser de maxim 128 de caractere! |
| 108 | + | new file[128], name[MAX_PLAYERS], str[128]; |
| 109 | - | GetPlayerName(playerid, name, MAX_PLAYERS); // ii va detecta numele pt salvare! |
| 109 | + | GetPlayerName(playerid, name, MAX_PLAYERS); |
| 110 | - | format(file, sizeof(file), "Users/%s.ini", name); // Aici este locul unde se va salva ! |
| 110 | + | format(file, sizeof(file), "Users/%s.ini", name); |
| 111 | - | if(response) { // iar acuma dupa ce si- scirs parola i se va crea un fiser !
|
| 111 | + | if(response) {
|
| 112 | if(strlen(inputtext)) {
| |
| 113 | - | dini_Create(file); // Aceasta comanda ii va crea fisierul cu urmatoarele! |
| 113 | + | dini_Create(file); |
| 114 | dini_IntSet(file, "Parola", PlayerInfo[playerid][Parola]); | |
| 115 | dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][pAdmin]); | |
| 116 | dini_IntSet(file, "Bani", PlayerInfo[playerid][pMoney]); | |
| 117 | dini_IntSet(file, "Level", PlayerInfo[playerid][pLevel]); | |
| 118 | dini_IntSet(file, "Sex", PlayerInfo[playerid][pSex]); | |
| 119 | dini_IntSet(file, "Spawn", PlayerInfo[playerid][pSpawn]); | |
| 120 | dini_IntSet(file, "Varsta", PlayerInfo[playerid][pVarsta]); | |
| 121 | - | format(str, sizeof(str), "Esti inregistrat ~r~%s. Parola ta este~r~%s.Nu o uita !", name, inputtext); // dupa ce se inregistreaza ii va trimite un mesaj cu parola si faptul ca s-a inregistrat cu succes// |
| 121 | + | format(str, sizeof(str), "Esti inregistrat ~r~%s. Parola ta este~r~%s.Nu o uita !", name, inputtext); |
| 122 | SendClientMessage(playerid, 0xAA3333AA, str); | |
| 123 | PlayerInfo[playerid][pLevel] = dini_Int(file, "Level"); | |
| 124 | PlayerInfo[playerid][pMoney] = dini_Int(file, "Bani"); | |
| 125 | PlayerInfo[playerid][pAdmin] = dini_Int(file, "AdminLevel"); | |
| 126 | PlayerInfo[playerid][pSex] = dini_Int(file, "Sex"); | |
| 127 | PlayerInfo[playerid][pSpawn] = dini_Int(file, "Spawn"); | |
| 128 | PlayerInfo[playerid][pVarsta] = dini_Int(file, "Varsta"); | |
| 129 | - | //ShowPlayerDialog(playerid, DIALOG_FULLNAME, DIALOG_STYLE_INPUT, "Nume", "Introdu numele tau complet.", "Ok" , ""); |
| 129 | + | ShowPlayerDialog(playerid, DIALOG_FULLNAME, DIALOG_STYLE_INPUT, "Nume", "Introdu numele tau complet.", "Ok" , ""); |
| 130 | } | |
| 131 | } | |
| 132 | else {
| |
| 133 | - | Kick(playerid); // iar daca da iesi si nu se inregistreaza va primi automat KICK! |
| 133 | + | |
| 134 | } | |
| 135 | } | |
| 136 | if(dialogid == DIALOG_FULLNAME) {
| |
| 137 | PlayerInfo[playerid][pFullName] = strlen(inputtext);//LS | |
| 138 | SendClientMessage(playerid,0xFFFFFFFF,"[{3399FF}NemeSys RPG{FFFFFF}]Bine,deci numele tau este %s.");
| |
| 139 | ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_LIST, "Esti baiat sau fata?", "Baiat \nFata", "Selecteaza" , ""); | |
| 140 | } | |
| 141 | if(dialogid == DIALOG_SEX) {
| |
| 142 | if(listitem == 0) {
| |
| 143 | PlayerInfo[playerid][pSex] = strlen("Baiat");//LS
| |
| 144 | SendClientMessage(playerid,0xFFFFFFFF,"[{3399FF}NemeSys RPG{FFFFFF}]Bine,deci esti baiat.");
| |
| 145 | ShowPlayerDialog(playerid, DIALOG_VARSTA, DIALOG_STYLE_INPUT, "Esti baiat sau fata?", "Masculin \nFeminin", "Selecteaza" , ""); | |
| 146 | } | |
| 147 | if(listitem == 1) {
| |
| 148 | PlayerInfo[playerid][pSex] = strlen("Fata");//LS
| |
| 149 | SendClientMessage(playerid,0xFFFFFFFF,"[{3399FF}NemeSys RPG{FFFFFF}]Bine,deci esti fata.");
| |
| 150 | ShowPlayerDialog(playerid, DIALOG_VARSTA, DIALOG_STYLE_INPUT, "Varsta", "Cati ani ai?", "Ok" , ""); | |
| 151 | } | |
| 152 | } | |
| 153 | if(dialogid == DIALOG_VARSTA) {
| |
| 154 | PlayerInfo[playerid][pVarsta] = strval(inputtext);//LS | |
| 155 | SendClientMessage(playerid,0xFFFFFFFF,"[{3399FF}NemeSys RPG{FFFFFF}]Bine,deci ai %d ani.");
| |
| 156 | ShowPlayerDialog(playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST, "Alege locul unde vrei sa fii spawnat.", "Los Santos \nLas Venturas \nSan Fierro", "Selecteaza" , ""); | |
| 157 | } | |
| 158 | if(dialogid == DIALOG_SPAWN) {
| |
| 159 | if(listitem == 0) | |
| 160 | {
| |
| 161 | PlayerInfo[playerid][pSpawn] = 1;//LS | |
| 162 | - | SendClientMessage(playerid,COLOR_WHITE,"[{3399FF}HardCore-Gaming{FFFFFF}]Bine,deci vei fi spawnat in Los Santos");
|
| 162 | + | SendClientMessage(playerid,COLOR_WHITE,"[{3399FF}HardCore-Gaming{FFFFFF}]Bine,deci vei fi spawnat in Los Santos");
|
| 163 | - | //SpawnPlayer(playerid); |
| 163 | + | ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Te rugam logheaza-te", "Introdu parola", "Login", "Cancel"); |
| 164 | - | ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Te rugam logheaza-te", "Introdu parola", "Login", "Cancel"); |
| 164 | + | } |
| 165 | - | } |
| 165 | + | else if(listitem == 1) |
| 166 | - | else if(listitem == 1) |
| 166 | + | {
|
| 167 | - | {
|
| 167 | + | PlayerInfo[playerid][pSpawn] = 2;//SF |
| 168 | - | PlayerInfo[playerid][pSpawn] = 2;//SF |
| 168 | + | SendClientMessage(playerid,COLOR_WHITE,"[{3399FF}HardCore-Gaming{FFFFFF}]Bine,deci vei fi spawnat in San Fierro");
|
| 169 | - | SendClientMessage(playerid,COLOR_WHITE,"[{3399FF}HardCore-Gaming{FFFFFF}]Bine,deci vei fi spawnat in San Fierro");
|
| 169 | + | ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Te rugam logheaza-te", "Introdu parola", "Login", "Cancel"); |
| 170 | - | //SpawnPlayer(playerid); |
| 170 | + | |
| 171 | - | ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Te rugam logheaza-te", "Introdu parola", "Login", "Cancel"); |
| 171 | + | else if(listitem == 2) |
| 172 | {
| |
| 173 | - | else if(listitem == 2) |
| 173 | + | PlayerInfo[playerid][pSpawn] = 3;//LV |
| 174 | - | {
|
| 174 | + | SendClientMessage(playerid,COLOR_WHITE,"[{3399FF}HardCore-Gaming{FFFFFF}]Bine,deci vei fi spawnat in Las Venturas");
|
| 175 | - | PlayerInfo[playerid][pSpawn] = 3;//LV |
| 175 | + | ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Te rugam logheaza-te", "Introdu parola", "Login", "Cancel"); |
| 176 | - | SendClientMessage(playerid,COLOR_WHITE,"[{3399FF}HardCore-Gaming{FFFFFF}]Bine,deci vei fi spawnat in Las Venturas");
|
| 176 | + | } |
| 177 | - | //SpawnPlayer(playerid); |
| 177 | + | |
| 178 | - | ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Te rugam logheaza-te", "Introdu parola", "Login", "Cancel"); |
| 178 | + | if(dialogid == DIALOG_LOGIN) {
|
| 179 | - | } |
| 179 | + | new file[128], name[MAX_PLAYERS], str[128]; |
| 180 | GetPlayerName(playerid, name, MAX_PLAYERS); | |
| 181 | - | if(dialogid == DIALOG_LOGIN) { // iar acuma daca jucatorul este inregistrat va trebui sa se logheze!
|
| 181 | + | format(str, sizeof(str), "Users/%s.ini", name); |
| 182 | - | new file[128], name[MAX_PLAYERS], str[128]; // fisierul // |
| 182 | + | if(response) {
|
| 183 | - | GetPlayerName(playerid, name, MAX_PLAYERS); // ii detecteaza numele sa vada daca este inregistrat! |
| 183 | + | |
| 184 | - | format(str, sizeof(str), "Users/%s.ini", name); // locul unde sunt conturile // |
| 184 | + | if(num_hash(inputtext) != dini_Int(file, "Parola")) {
|
| 185 | - | if(response) { // daca va scrie o parola gresita aceasta va fi verificata cu cea din fisier iar daca este incorecta ii va trimite mesaj cum ca a gresit parola!
|
| 185 | + | |
| 186 | ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Te rog logheaza-te!", "Introdu parola", "Login", "Cancel"); | |
| 187 | - | if(num_hash(inputtext) != dini_Int(file, "Parola")) { // aici verifica parola //
|
| 187 | + | |
| 188 | else {
| |
| 189 | SendClientMessage(playerid, 0xAA3333AA, "Te-ai logat cu succes distractie placuta pe server!"); | |
| 190 | PlayerInfo[playerid][pLevel] = dini_Int(file, "Level"); | |
| 191 | PlayerInfo[playerid][pMoney] = dini_Int(file, "Bani"); | |
| 192 | GivePlayerMoney(playerid, dini_Int(file, "Bani")); | |
| 193 | - | PlayerInfo[playerid][pLevel] = dini_Int(file, "Level"); // dupa ce s-a logat ii va da playerului ce a avut dupa deconectare adica levelul |
| 193 | + | |
| 194 | - | PlayerInfo[playerid][pMoney] = dini_Int(file, "Bani"); // banii // |
| 194 | + | |
| 195 | - | GivePlayerMoney(playerid, dini_Int(file, "Bani")); // iar cu aceasta functie ii va da banii inapoi // |
| 195 | + | |
| 196 | PlayerInfo[playerid][pVarsta] = dini_Int(file, "Varsta"); | |
| 197 | } | |
| 198 | } | |
| 199 | } | |
| 200 | else {
| |
| 201 | Kick(playerid); | |
| 202 | } | |
| 203 | } | |
| 204 | return 1; | |
| 205 | } |