Problem with input dialog text , i give rep , urgently!!!
#1

FIXED
Reply
#2

Maybe try this

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

not working!
Reply
#4

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
Reply
#5

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 !!!
Reply
#6

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]);
                }
            }
        }
    }
}
Reply
#7

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?
Reply
#8

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)