[Ajuda] Dъvida com mSelection
#1

Boa noite, eu tenho uma dъvida, Galera, й possнvel adicionar valores para cada item no mSelection?
por exemplo...
no item de ID 128 o valor serб de 10,000
porйm, no item de ID 283 o valor serб de 50,000
e se й possнvel adicionar o valor no textdraw
acho que fui claro o suficiente, isso й possнvel? se sim, como que eu faзo o mesmo?
Reply
#2

PHP код:
new planelist = mS_INVALID_LISTID;
public 
OnGameModeInit ()
{
    
planelist = LoadModelSelectionMenu ("planes.txt");
    return 
1;
}
public 
OnPlayerModelSelection (playerid, response, listid, modelid)
{
    if(
response)
    {
    
GivePlayerMoney(playerid, -10);
    }
    return 
1;
} 
Nгo sei muito de mSelect
Reply
#3

Quote:
Originally Posted by Santso
Посмотреть сообщение
PHP код:
new planelist = mS_INVALID_LISTID;
public 
OnGameModeInit ()
{
    
planelist = LoadModelSelectionMenu ("planes.txt");
    return 
1;
}
public 
OnPlayerModelSelection (playerid, response, listid, modelid)
{
    if(
response)
    {
    
GivePlayerMoney(playerid, -10);
    }
    return 
1;
} 
Nгo sei muito de mSelect
Disso eu tф ligado, tem como por o mesmo valor para todos os itens, porйm eu gostaria de um valor para cada item, obrigado pela resposta.
Reply
#4

Sim, й possнvel.

PHP код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
    if(
listid == SEULISTID)
    {
        if(!
response) return 1;
        
//Isto й o que vocк precisa:
        
switch(modelid)
        {
            case 
128: {
                
GivePlayerMoney(playerid, -10000);
                
// resto da funзгo ao selecionar este modelid
            
}
            case 
283: {
                
GivePlayerMoney(playerid, -50000);
                
// resto da funзгo ao selecionar este modelid
            
}
            
//... etc
        
}
    }
    return 
1;
} 
Reply
#5

Quote:
Originally Posted by InsaneBR
PHP код:
public OnPlayerModelSelection(playerid, response, listid, modelid) 
{ 
    if(
listid == SEULISTID) 
    { 
        if(!
response) return 1; 
         
//Isto й o que vocк precisa: 
         
switch(modelid) 
         { 
            case 
MODELID: { 
                
//funзгo ao selecionar este modelid 
            
} 
            case 
outroMODELID: { 
                
//funзгo ao selecionar este modelid 
            
} 
            
//... etc 
        
} 
    } 
    return 
1; 
} 
@EDIT

Consegui fazer uma base de como vou fazer:

PHP код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
    if(
listid == VeiculosList)
    {
        if(!
response)
            return 
1;
        new 
Float:Pos[4];
        
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        
GetPlayerFacingAngle(playerid, Pos[3]);
        switch(
modelid)
        {
            case 
400:
            {
                
CreateVehicle(400, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
            }
            case 
401:
            {
                
CreateVehicle(401, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
            }
            case 
402:
            {
                
CreateVehicle(402, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
            }
            case 
404:
            {
                
CreateVehicle(404, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
            }
        }
    }
    return 
1;
} 
Vlw flw!
Reply
#6

Quote:
Originally Posted by InsaneBR
Посмотреть сообщение
Sim, й possнvel.

PHP код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
    if(
listid == SEULISTID)
    {
        if(!
response) return 1;
        
//Isto й o que vocк precisa:
        
switch(modelid)
        {
            case 
128 : {
                
GivePlayerMoney(playerid, -10000);
                
// resto da funзгo ao selecionar este modelid
            
}
            case 
283: {
                
GivePlayerMoney(playerid, -50000);
                
// resto da funзгo ao selecionar este modelid
            
}
            
//... etc
        
}
    }
    return 
1;
} 
nгo creio, pensei em fazer assim pro cara mas depois pensei que nгo iria dar certo kkkkkkkkkkk, sou muito animal
Reply
#7

PHP код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
    if(
listid == VeiculosList)
    {
        if(!
response)
            return 
1;
        
format(File, sizeof(File), "Casas/Veiculos/Veiculo%d.ini", Player[playerid][CasaID]);
        switch(
modelid)
        {
            case 
400:
            {
                if(
Player[playerid][Saldo] < 65000)
                    return 
SendClientMessage(playerid, Vermelho, "| ERRO | Vocк nгo tem saldo suficiente para comprar este veнculo! /Precos");
                
                
Player[playerid][Saldo] -= 65000;
                
                
DOF2::SetInt(File, "VeiculoModelo", 400);
                
DOF2::SetInt(File, "VeiculoPreco", 65000);
                
DOF2::SetInt(File, "VeiculoColor1", 0);
                
DOF2::SetInt(File, "VeiculoColor2", 0);
                
                
DestroyVehicle(DOF2::GetInt(File, "VeiculoCasa"));
                
DOF2::SetInt(File, "VeiculoCasa", CreateVehicle(400, DOF2::GetFloat(File, "VeiculoX"), DOF2::GetFloat(File, "VeiculoY"), DOF2::GetFloat(File, "VeiculoZ"), DOF2::GetFloat(File, "VeiculoA"), 0, 0, -1));
                
DOF2::SaveFile();
                
SendClientMessage(playerid, Azul, "| INFO | Vocк comprou como veнculo de sua casa {FF0000}Landstalker {1E90FF}Valor {008000}$65.000");
            } 
Atй que ta dando certo :v Eu fui pensar o ruim й que mSelection nгo aparece os preзos ai eu vo te que fazer uma Dialog com Preзos dos veнculos

Se for por TextDraw aparece mais da trabalho й nгo faзo ideia de como faзo :z talvez eu faзa por dialog mesmo esse sistema de veiculo casa :z DIALOG_STYLE_TABLIST_HEADERS

obs: tbm vou colocar isso por enum nгo se se й o recomendado mas..
Reply
#8

Quote:
Originally Posted by InsaneBR
Посмотреть сообщение
Sim, й possнvel.

PHP код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
    if(
listid == SEULISTID)
    {
        if(!
response) return 1;
        
//Isto й o que vocк precisa:
        
switch(modelid)
        {
            case 
128 : {
                
GivePlayerMoney(playerid, -10000);
                
// resto da funзгo ao selecionar este modelid
            
}
            case 
283: {
                
GivePlayerMoney(playerid, -50000);
                
// resto da funзгo ao selecionar este modelid
            
}
            
//... etc
        
}
    }
    return 
1;
} 
No meu caso eu utilizo assim:

PHP код:
public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
{
    if(
extraid==DIALOG_ATTACH_MODEL_SELECTION)
    {
        if(!
response)
         {   
ShowPlayerDialog(playerid,DIALOG_ATTACH_OBJECT_SELECTION,DIALOG_STYLE_LIST,"Acessуrios: (Selecione para onde irб ficar o objeto)",COL_GREY "Menu de Acessуrios"COL_GREY"Objeto Personalizado","Prуximo","Anterior");    }
        if(
response)
        {
            if(
GetPVarInt(playerid, "AttachmentUsed") == 1) EditAttachedObject(playerid, modelid);
            else
            {
                
SetPVarInt(playerid, "AttachmentModelSel", modelid);
                new 
string[256+1];
                new 
dialog[500];
                for(new 
x;x<sizeof(AttachmentBones);x++)
                {
                    
format(string, sizeof(string), "%s\n", AttachmentBones[x]);
                    
strcat(dialog,string);
                }
                
ShowPlayerDialog(playerid, DIALOG_ATTACH_BONE_SELECTION, DIALOG_STYLE_LIST, \
                
"{FF0000}Modificaзгo dos Acessуrios", dialog, "Selecionar", "Cancelar");
            }
//else DeletePVar(playerid, "AttachmentIndexSel");
        
}
     }
    return 
1;
} 
e crio a minha lista de objetos no prуprio gamemode

PHP код:
new AttachmentObjectsList[] = {
18632,
18633,
18634,
18635,
[...] 
Entгo como funcionaria?
Reply
#9

Quote:
Originally Posted by SIZET
Посмотреть сообщение
@EDIT

Consegui fazer uma base de como vou fazer:

PHP код:
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
    if(
listid == VeiculosList)
    {
        if(!
response)
            return 
1;
        new 
Float:Pos[4];
        
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        
GetPlayerFacingAngle(playerid, Pos[3]);
        switch(
modelid)
        {
            case 
400:
            {
                
CreateVehicle(400, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
            }
            case 
401:
            {
                
CreateVehicle(401, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
            }
            case 
402:
            {
                
CreateVehicle(402, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
            }
            case 
404:
            {
                
CreateVehicle(404, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
            }
        }
    }
    return 
1;
} 
Vlw flw!
Vocк pode fazer de uma forma mais organizada, veja:
PHP код:
switch(modelid)
{
    case 
400: GivePlayerMoney(playerid, -10);
    case 
401: GivePlayerMoney(playerid, -20);
    
//...
}
//Apуs esta verificaзгo, basta usar somente uma vez a funзгo CreateVehicle.
CreateVehicle(modelid, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1); 
__

Quote:
Originally Posted by Raayzeck
Посмотреть сообщение
No meu caso eu utilizo assim:

PHP код:
public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
{
    if(
extraid==DIALOG_ATTACH_MODEL_SELECTION)
    {
        if(!
response)
         {   
ShowPlayerDialog(playerid,DIALOG_ATTACH_OBJECT_SELECTION,DIALOG_STYLE_LIST,"Acessуrios: (Selecione para onde irб ficar o objeto)",COL_GREY "Menu de Acessуrios"COL_GREY"Objeto Personalizado","Prуximo","Anterior");    }
        if(
response)
        {
            if(
GetPVarInt(playerid, "AttachmentUsed") == 1) EditAttachedObject(playerid, modelid);
            else
            {
                
SetPVarInt(playerid, "AttachmentModelSel", modelid);
                new 
string[256+1];
                new 
dialog[500];
                for(new 
x;x<sizeof(AttachmentBones);x++)
                {
                    
format(string, sizeof(string), "%s\n", AttachmentBones[x]);
                    
strcat(dialog,string);
                }
                
ShowPlayerDialog(playerid, DIALOG_ATTACH_BONE_SELECTION, DIALOG_STYLE_LIST, \
                
"{FF0000}Modificaзгo dos Acessуrios", dialog, "Selecionar", "Cancelar");
            }
//else DeletePVar(playerid, "AttachmentIndexSel");
        
}
     }
    return 
1;
} 
e crio a minha lista de objetos no prуprio gamemode

PHP код:
new AttachmentObjectsList[] = {
18632,
18633,
18634,
18635,
[...] 
Entгo como funcionaria?
Da mesma forma que forneci no exemplo, vocк utilizaria desta forma:

PHP код:
switch(modelid) 
{
    case 
18632: {
        
//Funзгo que vocк quer para este modelo    
    
}
    case 
18633: {
        
//Funзгo que vocк quer para este modelo    
    
}
    case 
18634: {
        
//Funзгo que vocк quer para este modelo    
    
}
    case 
18635: {
        
//Funзгo que vocк quer para este modelo    
    
}
} 
Reply
#10

Ok, agradeзo. +REP
Sу tenho mais uma dъvida, como eu poderia adicionar algo em cada box dizendo o valor de cada objeto?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)