04.01.2014, 03:05
So basically I was playing around with commands to make sure everything works, and not everything does. I have a Y_INI saving system, and part of the problem resides in Y_INI. Basically, when I use my /getgun command it's supposed to show a dialog. It does show this dialog, but when I click the gun I want, it bugs hardcore. Before I added my registration system, it used to just give me the gun and everything would be fine and dandy. Now when I click it, it shows a dialog that tells the user to relog in order to save their stats, and it doesn't give you the gun. Plus it spawns you at a location with CJ's skin on. Then when you relog, it says your password isn't the correct password. I'll post the dialog code first:
Next, the getgun command and the dialog for spawning a car:
What have I done wrong that is making this bug happen? Any help would be GREATLY appreciated. Thanks in advance to anyone who can solve this issue.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1) { if(response) { if(listitem == 0) { GivePlayerWeapon(playerid, 24, 99999999); SendClientMessage(playerid, COLOR_RED, "You have been given a desert eagle!"); } if(listitem == 1) { GivePlayerWeapon(playerid, 29, 99999999); SendClientMessage(playerid, COLOR_RED, "You have been given an MP5!"); } if(listitem == 2) { GivePlayerWeapon(playerid, 27, 99999999); SendClientMessage(playerid, COLOR_RED, "You have been given a SPAS12!"); } if(listitem == 3) { GivePlayerWeapon(playerid, 31, 99999999); SendClientMessage(playerid, COLOR_RED, "You have been given an M4!"); } if(listitem == 4) { GivePlayerWeapon(playerid, 34, 99999999); SendClientMessage(playerid, COLOR_RED, "You have been given a sniper rifle!"); } } } if(dialogid == 12) { if(response == 1) { if(listitem == 0) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(411, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 1) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(562, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 2) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(451, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } } } switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\n""Type your password below to register a new account.","Register","Quit"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_Close(File); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","You need to relog to save your stats!","Ok",""); } } 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); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Success!","You have successfully logged in!","Ok",""); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\n""Type your password below to login.","Login","Quit"); } return 1; } } } return 1; }
Код:
CMD:spawncar(playerid, params[]) { ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Cars:","Infernus\nElegy\nTurismo\n","Select","Cancel"); return 1; } CMD:getgun(playerid, params[]) { if(IsPlayerConnected(playerid)) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Weapon Giving", "Deagle\nMP5\nSPAS12\nM4A1\nSniper", "Choose", "Decline"); } else { SendClientMessage(playerid, COLOR_RED, "You need to be logged in to use that command!"); } return 1; }