SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/03/2019, 08:40 PM   #1
N3cromancer
Big Clucker
 
N3cromancer's Avatar
 
Join Date: Feb 2015
Location: Venezuela
Posts: 137
Reputation: 10
Default Small question about dialog listitem variable.

Hello guys i have a little question about listitem in Dialogs.

I wanna show my owned cars in a dialog list to manage it (change colors etc..) it shows fine in a list
but how i can pass a variable to detect the vehicleid selected on the dialog when i reach OnDialogResponse?

This is the command that i made to show my cars in a list.

PHP Code:
CMD:misvehiculos(playeridparam[])
{
    if(!
GetPlayerVehiclesCount(playerid)) return Message(playeridCOLOR_MSG_AVISOS"No tienes vehÝculos.");

    new 
sEncontrar[64];
    for(new 
0MAX_VEHICLESi++)
    {
        if(
cInfo[i][ownerID] == pInfo[playerid][pID])
        {
            
format(sEncontrarsizeof(sEncontrar), "%s [M: %d] "VehicleNames[cInfo[i][model]-400], cInfo[i][matricula]);
          
        }
    }

    
ShowPlayerDialog(playerid515DIALOG_STYLE_LIST"GPS de VehÝculos"sEncontrar"Aceptar""Cancelar");
    return 
1;

Thanks in advance.
All help will be rep!
__________________
Need scripter for fix bugs / make new systems to your server? add me on Discord: LuisR#9288
N3cromancer is offline   Reply With Quote
Old 14/03/2019, 08:42 PM   #2
SymonClash
Banned
 
Join Date: Dec 2018
Posts: 254
Reputation: 25
Default Re: Small question about dialog listitem variable.

Use pVars.

Use SetPVarInt to store selected vehicleid, then GetPVarInt to retrieve it.

After you made everything, just delete it with DeletePVar.
SymonClash is offline   Reply With Quote
Old 14/03/2019, 08:45 PM   #3
N3cromancer
Big Clucker
 
N3cromancer's Avatar
 
Join Date: Feb 2015
Location: Venezuela
Posts: 137
Reputation: 10
Default Re: Small question about dialog listitem variable.

Quote:
Originally Posted by SymonClash View Post
Use pVars.

Use SetPVarInt to store selected vehicleid, then GetPVarInt to retrieve it.

After you made everything, just delete it with DeletePVar.
Thanks for you reply, but how i can do it? for example what happen if i have more than 1 car and i select the second one, how i can store it? im really confused.
__________________
Need scripter for fix bugs / make new systems to your server? add me on Discord: LuisR#9288
N3cromancer is offline   Reply With Quote
Old 14/03/2019, 08:53 PM   #4
raydx
Huge Clucker
 
raydx's Avatar
 
Join Date: Feb 2017
Posts: 203
Reputation: 73
Default Re: Small question about dialog listitem variable.

DynamicGui Include, very usefull thing - https://pastebin.com/fPgZvzqb

Code:
CMD:misvehiculos(playerid, param[]) 
{ 
    if(!GetPlayerVehiclesCount(playerid)) return Message(playerid, COLOR_MSG_AVISOS, "No tienes vehÝculos."); 
    DynamicGui_Init(playerid);

    new sEncontrar[64]; 
    for(new i = 0; i < MAX_VEHICLES; i++) 
    { 
        if(cInfo[i][ownerID] == pInfo[playerid][pID]) 
        { 
            DynamicGui_AddRow(playerid, i);	
            format(sEncontrar, sizeof(sEncontrar), "%s [M: %d] ", VehicleNames[cInfo[i][model]-400], cInfo[i][matricula]); 
           
        } 
    } 

    ShowPlayerDialog(playerid, 515, DIALOG_STYLE_LIST, "GPS de VehÝculos", sEncontrar, "Aceptar", "Cancelar"); 
    return 1; 
}
Now you can get it inside ondialogresponse, example:

Code:
new vehicleid = DynamicGui_GetValue(playerid, listitem)
raydx is offline   Reply With Quote
Old 14/03/2019, 09:13 PM   #5
N3cromancer
Big Clucker
 
N3cromancer's Avatar
 
Join Date: Feb 2015
Location: Venezuela
Posts: 137
Reputation: 10
Default Re: Small question about dialog listitem variable.

Quote:
Originally Posted by raydx View Post
DynamicGui Include, very usefull thing - https://pastebin.com/fPgZvzqb

Code:
CMD:misvehiculos(playerid, param[]) 
{ 
    if(!GetPlayerVehiclesCount(playerid)) return Message(playerid, COLOR_MSG_AVISOS, "No tienes vehÝculos."); 
    DynamicGui_Init(playerid);

    new sEncontrar[64]; 
    for(new i = 0; i < MAX_VEHICLES; i++) 
    { 
        if(cInfo[i][ownerID] == pInfo[playerid][pID]) 
        { 
            DynamicGui_AddRow(playerid, i);	
            format(sEncontrar, sizeof(sEncontrar), "%s [M: %d] ", VehicleNames[cInfo[i][model]-400], cInfo[i][matricula]); 
           
        } 
    } 

    ShowPlayerDialog(playerid, 515, DIALOG_STYLE_LIST, "GPS de VehÝculos", sEncontrar, "Aceptar", "Cancelar"); 
    return 1; 
}
Now you can get it inside ondialogresponse, example:

Code:
new vehicleid = DynamicGui_GetValue(playerid, listitem)
Ill test it! thanks for the reply.
__________________
Need scripter for fix bugs / make new systems to your server? add me on Discord: LuisR#9288
N3cromancer is offline   Reply With Quote
Old 14/03/2019, 09:50 PM   #6
N3cromancer
Big Clucker
 
N3cromancer's Avatar
 
Join Date: Feb 2015
Location: Venezuela
Posts: 137
Reputation: 10
Default Re: Small question about dialog listitem variable.

Not work bro im getting problems with that include alot mismatch arguments.
__________________
Need scripter for fix bugs / make new systems to your server? add me on Discord: LuisR#9288
N3cromancer is offline   Reply With Quote
Old 14/03/2019, 10:59 PM   #7
N3cromancer
Big Clucker
 
N3cromancer's Avatar
 
Join Date: Feb 2015
Location: Venezuela
Posts: 137
Reputation: 10
Default Re: Small question about dialog listitem variable.

I find the solution, this topic can be closed, thanks all for the help all be repped!
__________________
Need scripter for fix bugs / make new systems to your server? add me on Discord: LuisR#9288
N3cromancer is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Small question about cache variable Sjn Scripting Help 2 26/12/2015 12:41 PM
Dialog Listitem ancezas Scripting Help 8 04/03/2014 02:14 PM
Dialog listitem question. fordawinzz Scripting Help 4 14/09/2012 09:23 PM
[QUESTION]Dialog listitem show/hide ? shamortiy Scripting Help 4 02/09/2012 10:30 PM
[Help]Dialog's listitem Smage Help Archive 0 31/12/2009 08:01 AM


All times are GMT. The time now is 07:59 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.