19.09.2010, 10:49
Ok well ive atempted to make an rp script and the way i store all my player information is in a Dini
The information is stored into the dini fine and worked fine until i realised something.
Firstly this is how the dini is created its created inside scriptfiles\Players and then inside that is the dini that is named as the players ingame name and inside that is all the player statistics.
To help you understand whats happening i will create a senario.
2 players are in the server
1 has a drivers license, the other one doesnt
( in the dini its driverslicense = 0 if they dont have a lisence and 1 if they do)
the player who has their drivers license attempts to get into a car and is instantly kicked out because it says he doesnt have a license but he does.
For some reason the information between the 2 user accounts is intersecting with each other. As you can imagine this will cause chaos within my whole script. We have tried using enums and they still intersect with each other.
That is the dialog for registration and login Hope somebody knows how to fix my problem its really holding me back
The information is stored into the dini fine and worked fine until i realised something.
Firstly this is how the dini is created its created inside scriptfiles\Players and then inside that is the dini that is named as the players ingame name and inside that is all the player statistics.
To help you understand whats happening i will create a senario.
2 players are in the server
1 has a drivers license, the other one doesnt
( in the dini its driverslicense = 0 if they dont have a lisence and 1 if they do)
the player who has their drivers license attempts to get into a car and is instantly kicked out because it says he doesnt have a license but he does.
For some reason the information between the 2 user accounts is intersecting with each other. As you can imagine this will cause chaos within my whole script. We have tried using enums and they still intersect with each other.
Quote:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 67 && response == 1)//login { new tmp = dini_Int(User[playerid][pFile], "HPassword"); if(!strlen(inputtext[0])) return SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: /login [password]"); if(!dini_Exists(User[playerid][pFile])) return SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: You are not registered!"); if(logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: You are already logged in!"); if(udb_hash(inputtext[0]) != tmp) { format(String, 256, "You specified the wrong password for %s!You are being Kicked.", User[playerid][pName]); SendClientMessage(playerid, COLOR_RED, String); Kick(playerid); } else { logged[playerid] = 1; format(String, sizeof(String), "Welcome~n~~r~%s",User[playerid][pName]); GameTextForPlayer(playerid, String, 6000, 1); User[playerid][pAdminLevel] = dini_Int(User[playerid][pFile], "AdminLevel"); User[playerid][px] = dini_Float(User[playerid][pFile], "z"); User[playerid][py] = dini_Float(User[playerid][pFile], "y"); User[playerid][pz] = dini_Float(User[playerid][pFile], "z"); User[playerid][pLicense] = dini_Int(User[playerid][pFile], "License"); User[playerid][pScore] = dini_Int(User[playerid][pFile], "Score"); User[playerid][pMoney] = dini_Int(User[playerid][pFile], "Money"); SetPlayerScore(playerid, User[playerid][pScore]); new lebel = User[playerid][pAdminLevel]; SetPlayerPos(playerid,User[playerid][px],User[playerid][py],User[playerid][pz]); ResetPlayerMoney(playerid); GivePlayerMoney(playerid,User[playerid][pMoney]); AllowTele[playerid]=1; format(String, 256, "[SYSTEM]: Successfully logged in! (level: %d)!", lebel); SendClientMessage(playerid,COLOR_RED, String); printf("%s (%i) logged in with password %s", User[playerid][pName], playerid, inputtext[0]); } return 1; } if(dialogid == 70 && response == 1)//register { if(!strlen(inputtext[0])) SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: /register [password]"); if(dini_Exists(User[playerid][pFile])) SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: You are already registered!"); else { dini_Create (User[playerid][pFile]); dini_IntSet (User[playerid][pFile], "HPassword", udb_hash(inputtext[0])); dini_Set (User[playerid][pFile], "Password", inputtext[0]); dini_IntSet (User[playerid][pFile], "Interior",0); dini_IntSet (User[playerid][pFile], "AdminLevel",0); dini_IntSet (User[playerid][pFile], "Score", 0); dini_IntSet (User[playerid][pFile], "License", 0); dini_IntSet (User[playerid][pFile], "Money", 10000); User[playerid][pAdminLevel] = dini_Int(User[playerid][pFile], "AdminLevel"); User[playerid][px] = dini_Float(User[playerid][pFile], "z"); User[playerid][py] = dini_Float(User[playerid][pFile], "y"); User[playerid][pz] = dini_Float(User[playerid][pFile], "z"); User[playerid][pLicense] = dini_Int(User[playerid][pFile], "License"); User[playerid][pScore] = dini_Int(User[playerid][pFile], "Score"); User[playerid][pMoney] = dini_Int(User[playerid][pFile], "Money"); ResetPlayerMoney(playerid); GivePlayerMoney(playerid,User[playerid][pMoney]); //dini_IntSet(file, "job1", 0);dini_IntSet(file, "job2", 0);dini_IntSet(file, "job3", 0);dini_IntSet(file, "job4", 0); format(String, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s", User[playerid][pName], inputtext[0]); SendClientMessage(playerid, COLOR_YELLOW, String); logged[playerid] = 1; SetPlayerPos(playerid, 1742.948242,-1860.797973,13.578297); SendClientMessage(playerid, COLOR_YELLOW, "[SYSTEM]: You have been automatically logged in!"); } return 1; } } |