This is a test forum with a static import from forum.open.mp it will not be automatically synchronised so any posts you make here will be lost when we migrate fully.

Home
Search
New thread

Discussion

Discussion categories

General
Chat
Tech
Life
Art
Programming
open.mp
Development Updates
Questions and Suggestions
SA-MP
General Discussions
Videos and Screenshots
Support
Pawn Scripting
Tutorials
Releases
Plugins
Libraries
Filterscripts
Gamemodes
Maps
Advertisements
Other languages
Spanish/Espa?ol
Programaci?n
Discusi?n GTA SA Multijugador
Mods
Offtopic
Juegos
Portuguese/Portugu?s
Russian/русский
Italian/Italiano
Dutch/Nederlands
German/Deutsch
Romanian/Rom?na
Ex-Yu
Polish/Polski
Og?lne
Serwery
Skryptowanie
Filmiki i zdjecia
Lithuanian/Lietuvi?kas
French/Fran?ais
Hungarian/Magyar
Hindi/Urdu
Turkish
Other
Internal
Hidden

Library

Library pages

Collections
Links
Members
Roles
RegisterLogin
Login
Discussion
Pawn Scripting
Não consigo criar motos
contatofelipeojustin's avatar

contatofelipeojustin

@contatofelipeojustin


View profile
Copy link
  Report member
• 2y
Pawn Scripting

Não consigo criar motos

pawn

Sou novo no Open.MP e no Qawno, estou querendo fazer um servidor de fugas e pvp. Testei um sistema de criar motos bem básico, mas não estou tendo resultado na criação da moto, o sistema funciona com base no comando: /moto (utilizei a include do ZCMD), esse comando abre uma dialog que é possível escolher uma moto, mas não cria a moto. Alguém pode me ajuda? Meu Código(coloque ias partes principais):

#include <open.mp>
#include <a_samp>

#include <zcmd>



new Float:PlayerX;

new Float:PlayerY;

new Float:PlayerZ;



public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

    if(dialogid == ESCOLHER_MOTOS)

    {

        if(response)

        {

            switch(listitem)

            {

                case 0:

                {

                    // Obtém a posição e o ângulo do jogador

                    GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);

                    new Float:PlayerAngle;

                    GetPlayerFacingAngle(playerid, PlayerAngle);

                   

                    // Calcula a nova posição na frente do jogador

                    new Float:OffsetX, Float:OffsetY, Float:OffsetZ = 1.0; // Um pouco acima

                    OffsetX = PlayerX + (3.0 * floatsin(-PlayerAngle, degrees)); // 3 unidades na frente

                    OffsetY = PlayerY + (3.0 * floatcos(-PlayerAngle, degrees)); // 3 unidades na frente



                    // Envia uma mensagem ao jogador com as novas coordenadas

                    new str[128];

                    format(str, sizeof(str), "Nova posição para criar a moto: X: %f, Y: %f, Z: %f", OffsetX, OffsetY, PlayerZ + OffsetZ);

                    SendClientMessage(playerid, -1, str);



                    // Cria o veículo na nova posição

                    new vehicleid = AddStaticVehicleEx(522, OffsetX, OffsetY, PlayerZ + OffsetZ, PlayerAngle, -1, -1, 1000, false);

                   

                    // Verifica se o veículo foi criado com sucesso

                    if(vehicleid == INVALID_VEHICLE_ID)

                    {

                        SendClientMessage(playerid, -1, "Falha ao criar a moto.");

                    }

                    else

                    {

                        SendClientMessage(playerid, -1, "Moto NRG-500 criada com sucesso.");

                    }

                }

            }

        }

    }

    return 1;

}



CMD:moto(playerid)

{

ShowPlayerDialog(playerid, 876, DIALOG_STYLE_LIST, "Motos", "NRG-500", "Selecionar", "Cancelar");

return 1;
}
0 likes0 replies

    Please sign up or log in to reply