Jump to content
  • 0

Cum setez un mapicon in mai multe locatii


Question

Posted (edited)

Salutare,

Stie careva cum setez un mapicon in mai multe locatii 

Exemplu: sa setez 3 masini pe sv si pe toate 3 cate un mapicon global pentru un quest

Edited by pawn

2 answers to this question

Recommended Posts

  • 0
Posted
// Definim variabilele global pentru a le putea accesa peste tot
new QuestVehicle[3];
new QuestIcon[3];

public OnGameModeInit()
{
    // Creăm cele 3 mașini de quest
    QuestVehicle[0] = CreateVehicle(411, 1000.0, -1000.0, 10.0, 0.0, -1, -1, 60000); // Exemplu Infernus
    QuestVehicle[1] = CreateVehicle(411, 1020.0, -1000.0, 10.0, 0.0, -1, -1, 60000);
    QuestVehicle[2] = CreateVehicle(411, 1040.0, -1000.0, 10.0, 0.0, -1, -1, 60000);

    // Creăm iconițele pe poziția inițială a mașinilor
    // Parametri: X, Y, Z, tip_iconiță (ex: 55 pentru mașină/quest), culoare, worldid, interiorid, playerid, streamdistance
    QuestIcon[0] = CreateDynamicMapIcon(1000.0, -1000.0, 10.0, 55, 0, -1, -1, -1, 6000.0);
    QuestIcon[1] = CreateDynamicMapIcon(1020.0, -1000.0, 10.0, 55, 0, -1, -1, -1, 6000.0);
    QuestIcon[2] = CreateDynamicMapIcon(1040.0, -1000.0, 10.0, 55, 0, -1, -1, -1, 6000.0);

    // Pornim un timer care să updateze poziția iconițelor după mașini (la fiecare secundă)
    SetTimer("UpdateQuestIcons", 1000, true);
    return 1;
}

// Forward pentru timer
forward UpdateQuestIcons();
public UpdateQuestIcons()
{
    new Float:x, Float:y, Float:z;
    for(new i = 0; i < 3; i++)
    {
        // Luăm poziția curentă a mașinii (în caz că se mișcă)
        GetVehiclePos(QuestVehicle[i], x, y, z);
        
        // Update la poziția iconiței dinamice
        Streamer_SetFloatData(STREAMER_TYPE_MAP_ICON, QuestIcon[i], E_STREAMER_X, x);
        Streamer_SetFloatData(STREAMER_TYPE_MAP_ICON, QuestIcon[i], E_STREAMER_Y, y);
        Streamer_SetFloatData(STREAMER_TYPE_MAP_ICON, QuestIcon[i], E_STREAMER_Z, z);
    }
    return 1;
}

Daca vrei cu ID de player
 

new QuestVehicle[2];

public OnGameModeInit()
{
    QuestVehicle[0] = CreateVehicle(411, 1000.0, -1000.0, 10.0, 0.0, -1, -1, 60000);
    QuestVehicle[1] = CreateVehicle(411, 1020.0, -1000.0, 10.0, 0.0, -1, -1, 60000);
    
    SetTimer("UpdateNativeIcons", 1000, true);
    return 1;
}

forward UpdateNativeIcons();
public UpdateNativeIcons()
{
    new Float:x, Float:y, Float:z;
    
    // Trecem prin toți jucătorii online
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            // Pentru mașina 1 (folosim slotul de iconiță 10)
            GetVehiclePos(QuestVehicle[0], x, y, z);
            SetPlayerMapIcon(i, 10, x, y, z, 55, 0, MAPICON_GLOBAL);
            
            // Pentru mașina 2 (folosim slotul de iconiță 11)
            GetVehiclePos(QuestVehicle[1], x, y, z);
            SetPlayerMapIcon(i, 11, x, y, z, 55, 0, MAPICON_GLOBAL);
        }
    }
    return 1;
}

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.