Jump to content
  • 0

Problema vehicule personale (+REP)


Poischi

Question

Problema intalnita (descriere): Problema este legata de vehiculele personale. Vreau ca atunci cand,un player care detine o masina, iese sa se verifice daca acesta detine o masina personala sau nu. Daca detine masina personala, scriptul sa verifice daca este condusa sau nu in momentul in care playerul iese. Daca nu este condusa de nimeni, masina sa se stearga. Daca este condusa de cineva, masina sa nu dispara. PROBLEMA este ca scriptul meu verifica doar daca este ID 0 (sau cel mai mic ID conectat pe server) ONLINE, deci doar la un singur ID verifica, la celalalte ID-uri nu. Deci daca playerul cu ID 0 detine o masina personala si acesta iese dar ID 1 este in masina, scriptul detecteaza ca nimeni nu e in masina. In schimb, daca ID 1 detine o masina si vrea sa iasa iar ID 0 este conectat , scriptul detecteaza ca acesta se afla in masina detinuta de ID 1.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu):

Citat

new myCount;
    foreach(Player, i)
    {
    for(new p; p <= pCount; p++)
    {
    if(PlayerInfo[playerid][pID] == vPrivate[p][vpMySQL] && vPrivate[p][vpOnVariable2] == 0 && vPrivate[p][vpID] > 0 )    
    {
        if(IsPlayerInVehicle(playerid, vPrivate[p][vpID]))
        {
           vPrivate[p][vpOnVariable2] = 2;
           if(vPrivate[p][vpCarSlot] == 1) { PlayerInfo[playerid][pVehicles][0] = 2; Update(playerid, pVehicles1u); }
           if(vPrivate[p][vpCarSlot] == 2) { PlayerInfo[playerid][pVehicles][1] = 2; Update(playerid, pVehicles2u); }
           if(vPrivate[p][vpCarSlot] == 3) { PlayerInfo[playerid][pVehicles][2] = 2; Update(playerid, pVehicles3u); }
           if(vPrivate[p][vpCarSlot] == 4) { PlayerInfo[playerid][pVehicles][3] = 2; Update(playerid, pVehicles4u); }
           if(vPrivate[p][vpCarSlot] == 5) { PlayerInfo[playerid][pVehicles][4] = 2; Update(playerid, pVehicles5u); }
           if(vPrivate[p][vpCarSlot] == 6) { PlayerInfo[playerid][pVehicles][5] = 2; Update(playerid, pVehicles6u); }
           if(vPrivate[p][vpCarSlot] == 7) { PlayerInfo[playerid][pVehicles][6] = 2; Update(playerid, pVehicles7u); }
           if(vPrivate[p][vpCarSlot] == 8) { PlayerInfo[playerid][pVehicles][7] = 2; Update(playerid, pVehicles8u); }
           if(vPrivate[p][vpCarSlot] == 9) { PlayerInfo[playerid][pVehicles][8] = 2; Update(playerid, pVehicles9u); }
           if(vPrivate[p][vpCarSlot] == 10) { PlayerInfo[playerid][pVehicles][9] = 2; Update(playerid, pVehicles10u); }
           timerDespawn[p] = SetTimerEx("vehicleDespawn", 10000, false, "i", p);          
           SendClientMessageToAll(COLOR_LIGHTRED, "Serverul a detectat ca cineva e in masina detinuta de playerul care a iesit. Masina a trecut pe variabila 2.");
        }
        else
        {    
        myCount++;
        SendClientMessageToAll(COLOR_RED, "Serverul a detectat ca nimeni nu e in masina detinuta de playerul care a iesit.");           
        DestroyVehicle(vPrivate[p][vpID]);
        vPrivate[p][vpID] = 0;
        vPrivate[p][vpOwner] = -1;
        }
    }
    }
    pCount2-= myCount;
    tCount-= myCount;        
    }


Imagini / Video (optional):
Ati incercat sa rezolvati singur?:  Da, dar nu am reusit.

Edited by Poischi
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • 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.