OnPlayerModelSelectionEx Vehicle
#1

I'm trying to remove this buy vehicle system on dialogs:
PHP код:
enum EConcessionaria {
    
modelo,
    
carname[32],
    
preco
}
new 
Concesssionaria[][EConcessionaria] = {
    {
566, "Tahoma", 30000},
    {
507, "Elegant", 310000},
    {
516, "Nebula", 312500},
    {
426, "Premier", 325000},
    {
468, "Sanchez", 350000},
    {
500, "Mesa", 40000},
    {
400, "Landstalk", 50000},
    {
579, "Huntley", 50000},
    {
434, "Hotknife", 80000},
    {
424, "BF Injection", 80000},
    {
555, "Windsor", 100000},
    {
603, "Phoenix", 150000},
    {
567, "Savanna", 1750000},
    {
602, "Alpha", 200000},
    {
587, "Euros", 200000},
    {
506, "Super GT", 200000},
    {
477, "ZR-350", 250000},
    {
562, "Elegy", 20000},
    {
415, "Cheetah", 25000},
    {
402, "Buffalo", 25000},
    {
429, "Banshee", 30000},
    {
480, "Comet", 35000},
    {
495, "Sandking", 35000},
    {
444, "Monster", 35000},
    {
451, "Turismo", 50000},
    {
560, "Sultan", 60000},
    {
541, "Bullet", 60000},
    {
411, "Infernus", 80000}
};
CMD:buycar(playerid) {
    new 
index = -1, a, str[100], final[3500];
    while(++
index < sizeof Concesssionaria) {
        
format(str, sizeof(str), "Vehicle: %s (%d$)\n", Concesssionaria[index][carname], Concesssionaria[index][preco]);
        
strcat(final, str);
        
Car_Listed[playerid][a] = index;
        
a++;
    }
    
ShowPlayerDialog(playerid, 14, DIALOG_STYLE_LIST, "Vehicles", final, "Comprar", "");
    return 
1;
} 
And add something more visual, i found the OnPlayerModelSelectionEx, looks amazing, but i'ts not working, i think i making something wrong, is anybody know how to help me?
PHP код:
CMD:buyveh(playerid) {
    new 
index = -1;
    new 
plane[96]; // 96 total de veiculos da conce
    
while(++index < sizeof Concesssionaria) {
        
plane[index] = Concesssionaria[index][modelo];
    }
    
ShowModelSelectionMenuEx(playerid, plane, index, "Buy Vehicle", DIALOGID_BUYVEH, 16.0, 0.0, -55.0);
    return 
1;
} 
PHP код:
public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
{
    if(
extraid == DIALOGID_BUYVEH)
    {
        if(
response)
        {
            new 
index = modelid;
            if(
GetPlayerMoneyEx(playerid) < Concesssionaria[index][preco]) return SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem dinheiro suficiente.");
            
GivePlayerMoneyEx(playerid, -Concesssionaria[index][preco] );
            new 
x = SERVER_VEHICLES + 1;
            new 
carid = -1;
            while(
carid == -1 && x < MAX_VEHICLES) {
                if(
VehicleInfo[x][vDonoID] == 0) { carid = x; }
                
x++;
            }
            if(
carid == -1) return SendClientMessage(playerid, COLOR_RED, "O servidor atingiu o limite maximo de veiculos ocupados, tente novamente mais depois!");
            
VehicleInfo[carid][vParkX] = 549.4260;
            
VehicleInfo[carid][vParkY] = -1271.7909;
            
VehicleInfo[carid][vParkZ] = 17.3374;
            
VehicleInfo[carid][vParkR] = 332.4741;
            
VehicleInfo[carid][vID] = CreateVehicle(VehicleInfo[carid][vModel], VehicleInfo[carid][vParkX], VehicleInfo[carid][vParkY], VehicleInfo[carid][vParkZ], VehicleInfo[carid][vParkR], 0, 0, 0);
            
PutPlayerInVehicle(playerid, carid, 0);
            
SendClientMessage(playerid, 0xFF0000FF, "You've buyed your vehicle!");
        }
        else 
SendClientMessage(playerid, 0xFF0000FF, "You've canceled your vehicle selection.");
    }
    return 
1;
} 
Two things are not working:
1- Next pages isn't work...
2- When i don't select a car works fine: else SendClientMessage(playerid, 0xFF0000FF, "You've canceled your vehicle selection.");
But when i select a valid car, nothing is working, not even SendClientMessage(playerid, 0xFF0000FF, "You've buyed your vehicle!");
Reply
#2

bump
Reply
#3

OnPlayerModelSelectionEx is not a default function, so is it mSelection.inc ?
if yes, than u must use .txt file to get models or update mSelection in last version.
Reply
#4

Quote:
Originally Posted by Mugala
Посмотреть сообщение
OnPlayerModelSelectionEx is not a default function, so is it mSelection.inc ?
if yes, than u must use .txt file to get models or update mSelection in last version.
I do using the mSelection.inc
And with my code it's showing the 20 first ones:
https://i.imgur.com/q9XRAsu.png

Working when i cancel: else SendClientMessage(playerid, 0xFF0000FF, "You've canceled your vehicle selection.");

Only next/prev pages not work

And when i select a model nothing is happen...

How should i do it?
Reply
#5

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)