I'm having a large problem with some commands and Y_INI
#1

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:
Код:
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;
}
Next, the getgun command and the dialog for spawning a car:

Код:
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;
}
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.
Reply
#2

Anyone have any ideas? It's quite an odd bug and I'm not sure what's causing it.
Reply
#3

So about hashing I would love to say udb is old and yeah.. whirlpool is the answer..

Please explain more
Quote:

I click the gun I want, it bugs hardcore.

Reply
#4

Would some SS' of the problems be of any help to anyone? My description of the issue might be a little cloudy, not sure.
Reply
#5

To explain more, when I click the gun I want, it automatically kills me and teleports me to the area you go to whilst registering for your first time. Then it gives me the registration skin, tells me to relog to save my stats (As I have it setup to in the actual registration system) and when I join back it says my password is wrong. Tried it with multiple accounts, same results. It's kind of like the /getgun command just bugs my Y_ini saving altogether.
Reply
#6

Is the ID from your weapon dialog the same as login/register?
Reply
#7

No, /getgun's dialog ID is 1, and the registration system's dialog ID is 12. It shows that in the code above. Does anyone have any idea why this is happening?
Reply
#8

Should I just entirely get rid of my /getgun system?
Reply
#9

Mate read my message what I sent to you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)