15.03.2017, 12:16
(
Последний раз редактировалось kuleke; 15.03.2017 в 15:37.
Причина: Solved
)
I've been doing this code for almost a whole day and I can not understand why the skin is not being stored.
I think he has come to understand that the fault is in the charge of the skin. (Pawno does not give me any error when compiling)
Thanks in advance, I have some great ideas to do a RP, hopefully I can get to contribute to the community.
I think he has come to understand that the fault is in the charge of the skin. (Pawno does not give me any error when compiling)
Код:
#include <a_samp> #include <YSI\y_ini> #define DIALOG_REGISTER 1 #define DIALOG_LOGIN 2 #define PATH "/Users/%s.ini" enum pInfo { pPass, pSkin } new PlayerInfo[MAX_PLAYERS][pInfo]; forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_Int("Pass",PlayerInfo[playerid][pPass]); INI_Int("Skin",PlayerInfo[playerid][pSkin]); return 1; } stock UserPath(playerid) { new string[128],playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),PATH,playername); return string; } stock udb_hash(buf[]) { new length=strlen(buf); new s1 = 1; new s2 = 0; new n; for (n=0; n<length; n++) { s1 = (s1 + buf[n]) % 65521; s2 = (s2 + s1) % 65521; } return (s2 << 16) + s1; } public OnPlayerConnect(playerid) { if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Inicio de sesiуn.","Escribe tu contraseсa para iniciar la sesiуn.","Iniciar","Cancelar"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registrando al jugador.","Escribe tu contraseсa para crear una nueva cuenta.","Registrar","Cancelar"); } return 1; } public OnPlayerDisconnect(playerid, reason) { new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Skin",GetPlayerSkin(playerid)); INI_Close(File); return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registrando al jugador.","Has introducido una clave invбlida.\nEscribe tu clave para registrar una nueva cuenta.","Registrar","Cancelar"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Pass",udb_hash(inputtext)); INI_WriteInt(File,"Skin",1); INI_Close(File); AddPlayerClass(PlayerInfo[playerid][pSkin], 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); AddPlayerClass(PlayerInfo[playerid][pSkin], 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Inicio de sesiуn.","Has introducido una clave invбlida.\nEscribe tu clave para iniciar la sesiуn.","Iniciar","Cancelar"); } return 1; } } } return 1; }