SA-MP Forums Archive
Problem with input dialog text , i give rep , urgently!!! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with input dialog text , i give rep , urgently!!! (/showthread.php?tid=544493)



Problem with input dialog text , i give rep , urgently!!! - buburuzu19 - 02.11.2014

FIXED


Re: Problem with input dialog text , i give rep , urgently!!! - Rudy_ - 02.11.2014

Maybe try this

pawn Код:
playerVariables[playerid][pCarColour1][0] = inputtext[playerid];



Re: Problem with input dialog text , i give rep , urgently!!! - buburuzu19 - 02.11.2014

not working!


Re: Problem with input dialog text , i give rep , urgently!!! - BroZeus - 02.11.2014

like this -
pawn Код:
playerVariables[playerid][pCarColour1][0] = strval(inputtext);
//and also one more line needs change --
format(saveQuery, sizeof(saveQuery), "UPDATE playeraccounts SET playerCarColour1 = '%d' WHERE playerID = '%d'", strval(inputtext), playerVariables[playerid][pInternalID]);
And also there is one mistake in the procedure, first you need check if inputtext is a integer or not if not then show error if yes then proceed further


Re: Problem with input dialog text , i give rep , urgently!!! - buburuzu19 - 02.11.2014

I fixed the problem myself , but now i got another , how to RESTRICTIONATE , i mean how to don't let the player enter in the dialog input letters and just numbers? Thanks !!!


Re: Problem with input dialog text , i give rep , urgently!!! - Quickie - 02.11.2014

pawn Код:
case 787:
{
    if(response)
    {
        if(!isnull(inputtext))
        {
            new input1; // you may change this variable to any name you want
            if(sscanf(inputtext,"d",input1)) // we only accept numbers and store it to input1
            {
                return SendClientMessage(playerid,-1,"We only accept numbers"); // your message if the player failed to put the right input
            }
                        // you can also add range restrictions eg. if(input1>20)return SendClientMessage
            new saveQuery[600];
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                new vehicleid = GetPlayerVehicleID(playerid);
                if(vehicleid == playerVariables[playerid][pCarID1])
                {
                    format(saveQuery, sizeof(saveQuery), "UPDATE playeraccounts SET playerCarColour1 = '%d' WHERE playerID = '%d'", input1, playerVariables[playerid][pInternalID]);// inputtext changed to input1
                    mysql_tquery(handle,saveQuery);
                    SetVehicleToRespawn(vehicleid);
                    playerVariables[playerid][pCarColour1][0] = input1; // inputtext changed to input1
                    SendClientMessage(playerid, COLOR_YELLOW, "You've succesful added x1 hidden to your slot 1.");
                    ChangeVehicleColor(vehicleid, playerVariables[playerid][pCarColour1][0]);
                }
            }
        }
    }
}



Re: Problem with input dialog text , i give rep , urgently!!! - buburuzu19 - 02.11.2014

Worked , i modified the code a lil ` bit , and i have got another problem:
If the player isn't in a vehicle he can acces the dialog btw it's added : if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) and how to send him a return message to tell him he needs to be in his personal car?


Re: Problem with input dialog text , i give rep , urgently!!! - BroZeus - 02.11.2014

like this -
pawn Код:
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)return SendClientMessage(.....);



Re: Problem with input dialog text , i give rep , urgently!!! - Quickie - 02.11.2014

pawn Код:
if(GetPlayerVehicleID(playerid)!=playerVariables[playerid][Vehicleid])return SendClientmessage(playerid,-1,"You must be in your own car");// change the playerVariables[playerid][Vehicleid] to the player variable where you save the owned car of the player
// above brozues code