Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Esse é um exemplo para criar carregamentos: Haveriam 4 variáveis, Produto, PosCarregamento e MsgCarregamento e ContCarregamento.
- Funcionaria da seguinte maneira: No comando /criarcarreg iria ir para um dialog onde você informaria o nome do produto, após isso o nome do local e o sistema iria pegar suas coordenadas. Após isso o nome do produto seria gravado no vetor Produto[0], o local no MsgCarregamento[0] e o PosCarregamento[0][1] a posição X, PosCarregamento[0][2] a posição Y, PosCarregamento[0][3] a posição Z. Após isso o ContCarregamento soma +1 e vai para a posição 1, fazendo com que na posição 0 dos vetores existente estejam armazenados os dados do carregamento anterior, e quando quiser adicionar outro ele irá ser armazenado nas posições [1], e assim em diante. No comando /listarcarreg é possível ver quais produtos foram criados e seus respectivos carregamentos, e no /poscarreg podem ser vistos suas coordenadas. (Isso é o que está feito no sistema abaixo)
- Caso fizesse o comando /t poderia usar o vetor dos produtos para saber quais existem e onde eles podem ser carregados, e caso selecionados pegar as coordenadas de sua respectiva posição. Também poderia expandir para colocar mais de 1 produto no mesmo local, criar para o descarregamento, etc. Teria também que colocar para salvar as variáveis em texto. */
- // ================================================== //
- new Produto[50][50];
- new Float: PosCarregamento[100][4];
- new MsgCarregamento[50][100];
- new ContCarregamento = 0;
- #define Dialog_Trabalho 48
- #define Dialog_CarregamentoP 49
- #define Dialog_CarregamentoN 50
- // ================================================== //
- CMD:criarcarreg (playerid, params[])
- {
- ShowPlayerDialog(playerid, Dialog_Trabalho, DIALOG_STYLE_LIST, "{ffffff}Editor rotas", "Criar carregamento\nCriar descarregamento\n", "Selecionar", "Fechar");
- return 1;
- }
- CMD:listarcarreg (playerid, params[])
- {
- new msgProd[100], msg[1000];
- if (ContCarregamento == 0){
- SendClientMessage(playerid, 0xffff00, "Não há carregamentos criados");
- }
- else{
- for (new i = 0; i < ContCarregamento; i++){
- format(msgProd, sizeof(msgProd), "[%d] - Produto: %s | Nome: %s\n", i, Produto[i], MsgCarregamento[i]);
- strins(msg, msgProd, strlen(msg));
- ShowPlayerDialog(playerid, 8484, DIALOG_STYLE_MSGBOX, "Carregamentos existentes", msg, "Ok", "");
- }
- }
- return 1;
- }
- CMD:poscarreg (playerid, params[])
- {
- new Coords[100], msg[1000];
- if (ContCarregamento == 0){
- SendClientMessage(playerid, 0xffff00, "Não há carregamentos criados");
- }
- else{
- for (new i = 0; i < ContCarregamento; i++){
- format(Coords, sizeof(Coords), "[%d] - X: %f | Y: %f | Z: %f\n", i, PosCarregamento[i][1], PosCarregamento[i][2], PosCarregamento[i][3]);
- strins(msg, Coords, strlen(msg));
- ShowPlayerDialog(playerid, 8484, DIALOG_STYLE_MSGBOX, "Coords dos Carregamentos", msg, "Ok", "");
- }
- }
- return 1;
- }
- // ================================================== //
- switch(dialogid){
- case Dialog_Trabalho:
- {
- if (response)
- {
- if (listitem == 0)
- {
- ShowPlayerDialog(playerid, Dialog_CarregamentoP, DIALOG_STYLE_INPUT,"{ffff00}Criar carregamento", "Informe o produto:\n", "Continuar", "Fechar");
- }
- }
- }
- case Dialog_CarregamentoP:
- {
- if (response)
- {
- strunpack(Produto[ContCarregamento], inputtext);
- ShowPlayerDialog(playerid, Dialog_CarregamentoN, DIALOG_STYLE_INPUT,"{ffff00}Criar carregamento", "Informe o nome do carregamento:\n", "Continuar", "Fechar");
- }
- }
- case Dialog_CarregamentoN:
- {
- if (response)
- {
- strunpack(MsgCarregamento[ContCarregamento], inputtext);
- GetPlayerPos(playerid, PosCarregamento[ContCarregamento][1], PosCarregamento[ContCarregamento][2], PosCarregamento[ContCarregamento][3]);
- ContCarregamento += 1;
- new Msg[100];
- strins(Msg,"{ff0000}Carregamento criado com sucesso!\n",strlen(Msg));
- return ShowPlayerDialog(playerid,8484, DIALOG_STYLE_MSGBOX, "Info Carregamento",Msg, "Fechar", "");
- }
- }
- }
- // ================================================== //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement