Jump to content
  • 0

Problema Checkpoint


Colentinian

Question

Salut, am facut un sistem de drag racing cu acelasi CP pentru ambii jucatori, insa daca cel care a dat /drag (id) intra primul in CP, acesta nu se dezactiveaza, se dezactiveaza doar daca intra cel care a dat /accept drag.

YCMD:drag(playerid, params[], help) {
    new userID, szMessage[180];
    if(!PlayerToPoint(10, playerid, 748.0566,-2379.0576,12.9100)) return SCM(playerid, COLOR_GREY, "Nu te aflii pe pista de drag.");
    if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER) return SCM(playerid, COLOR_ORANGE, "Nu esti la volanul unei masini!");
    if(sscanf(params, "u", userID)) return SCM(playerid, COLOR_GREY, "Syntax: {FFFFFF}/drag <playerid/name>");
    if(!IsPlayerConnected(userID) && userID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Acel player nu este conectat.");
    if(!PlayerToPoint(10, userID, 748.0566,-2379.0576,12.9100)) return SCM(playerid, -1, "Acel player nu este pe pista de drag!");
    if(GetPlayerState(userID)!=PLAYER_STATE_DRIVER) return SCM(playerid, COLOR_ORANGE, "Acel player nu este la volanul unei masini!");
    if(userID == playerid) return SCM(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda asupra ta!");
    if(!ProxDetectorS(10.0, playerid, userID)) return SCM(playerid, COLOR_GREY, "Nu esti langa acel jucator.");
    if(DragID[userID] == playerid) return SCM(playerid, COLOR_LGREEN, "Eroare: I-ai trimis deja o invitatie acestui player!");
    DragID[userID] = playerid;
    format(szMessage, 256, "%s(%d) te-a invitat sa faci o cursa cu el cu el! (/accept drag %d).", GetName(playerid), playerid, playerid);
    SCM(userID, 0xFAD4D4FF, szMessage);
    format(szMessage, 256, "L-ai invitat pe %s(%d) sa faca o cursa cu tine.", GetName(userID), userID);
    SCM(playerid, 0xFAD4D4FF, szMessage);
    return 1;
}    

 

if( strcmp ( x_job, "drag" , true ) == 0 )
    {
        new userID = id;
        if(DragID[playerid] == -1) return SCM(playerid,COLOR_WHITE,"Nimeni nu te-a invitat sa faci o cursa.");
        if(id == playerid) return SCM(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda asupra ta!");
        if(!PlayerToPoint(10, playerid, 748.0566,-2379.0576,12.9100)) return SCM(playerid, COLOR_GREY, "Nu te aflii pe pista de drag.");
        if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER) return SCM(playerid, COLOR_ORANGE, "Nu esti la volanul unei masini!");
        if(GetPVarInt(userID, "InDrag") == 1) return SCM(playerid, -1, "Acel player este deja intr-o cursa.");
        if(IsPlayerConnected(id)) {
            if(DragID[playerid] == id)
            {
                new vehuserid = GetPlayerVehicleID(userID);
                new    vehplayerid = GetPlayerVehicleID(playerid);
                if(!ProxDetectorS(10.0, playerid, id)) return SCM(playerid, COLOR_GREY, "Nu te aflii langa acel jucator!");
                SetPVarInt(playerid, "InDrag", 1);
                SetPVarInt(userID, "InDrag", 1);
                SetVehiclePosEx(userID, vehuserid, 756.0446,-2377.2810,12.6371);
                SetVehicleZAngleEx(vehuserid, 180);
                SetPlayerFacingAngle(userID, 183.8938);
                SetVehiclePosEx(playerid, vehplayerid, 740.3959,-2377.2373,12.6371);
                SetVehicleZAngleEx(vehplayerid, 180);
                SetPlayerFacingAngle(playerid, 183.8938);
                PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
                PutPlayerInVehicle(userID, GetPlayerVehicleID(userID), 0);
                TogglePlayerControllable(playerid, 0);
                TogglePlayerControllable(userID, 0);
                TextDrawShowForPlayer(playerid, CountTD);
                Countnr = 5;
                Count();
                TextDrawShowForPlayer(userID, CountTD);
                Countnr = 5;
                Count();
                SetTimerEx("drag", 5000, false, "i", playerid);
                SetTimerEx("drag", 5000, false, "i", userID);
                foreach(new i : Player)
                {
                    SetPlayerRaceCheckpoint(i, 1, 748.2872,-2689.0310,12.8837, 0.0,0.0,0.0, 25); 
                    CP[playerid] = 618;
                    
                }

    if(CP[playerid] == 618) {
        foreach(new i : Player)
        {
            DisablePlayerRaceCheckpoint(i);
            SetPVarInt(i, "InDrag", 0);    
        }
    }

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Ai gresit For-ul din comanda /accept drag.
Pune asa:
 

             foreach(new i : Player)
                {
                    SetPlayerRaceCheckpoint(i, 1, 748.2872,-2689.0310,12.8837, 0.0,0.0,0.0, 25); 
                    CP[i] = 618;
                }

 

Edited by Akan

Discord:
! Akan !#6675

Link to comment
Share on other sites

  • 0

multumesc, acum functioneaza, acum am vazut alta problema , i am pus functia de count , si functioneaza gresit, nu numara 5,4,3,2,1 , numara 5,3,1, am luat-o de la /count si acolo merge bine

(asta e sub CP = 618)

                    TextDrawShowForPlayer(i, CountTD);
                    Countnr = 5;
                    Countrace();
                    SetTimerEx("drag", 5000, false, "i", i);
                    TogglePlayerControllable(i, 0);

 

(asta e comanda si funcita count )

new Countnr;
YCMD:count(playerid, params[], help) {
    new number;
    if(sscanf(params, "i", number)) return SCM(playerid, COLOR_GREY, "Syntax: {FFFFFF}/count <nr>");
    if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, COLOR_GREY, "Nu ai acces la aceasta comanda.");
    if(number < 2 && number >= 360) return SCM(playerid, COLOR_LGREEN, "Eroare: Numar invalid. (1-360)");
    TextDrawShowForAll(CountTD);
    Countnr = number;
    Count();
    return true;

function Count() {
    new string[30];
    format(string, sizeof(string), "~w~Countdown: ~y~%d", Countnr);
    TextDrawSetString(CountTD, string);    
    if(Countnr >= -1) SetTimer("Count", 1000, 0);    
    Countnr --;
    if(Countnr == -1) TextDrawSetString(CountTD, "~r~GO! ~y~GO! ~b~GO!");
    if(Countnr == -2) TextDrawHideForAll(CountTD);
    return true;

 

Link to comment
Share on other sites

  • 0
1 hour ago, Colentinian said:

multumesc, acum functioneaza, acum am vazut alta problema , i am pus functia de count , si functioneaza gresit, nu numara 5,4,3,2,1 , numara 5,3,1, am luat-o de la /count si acolo merge bine

(asta e sub CP = 618)

                    TextDrawShowForPlayer(i, CountTD);
                    Countnr = 5;
                    Countrace();
                    SetTimerEx("drag", 5000, false, "i", i);
                    TogglePlayerControllable(i, 0);

 

(asta e comanda si funcita count )

new Countnr;
YCMD:count(playerid, params[], help) {
    new number;
    if(sscanf(params, "i", number)) return SCM(playerid, COLOR_GREY, "Syntax: {FFFFFF}/count <nr>");
    if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, COLOR_GREY, "Nu ai acces la aceasta comanda.");
    if(number < 2 && number >= 360) return SCM(playerid, COLOR_LGREEN, "Eroare: Numar invalid. (1-360)");
    TextDrawShowForAll(CountTD);
    Countnr = number;
    Count();
    return true;

function Count() {
    new string[30];
    format(string, sizeof(string), "~w~Countdown: ~y~%d", Countnr);
    TextDrawSetString(CountTD, string);    
    if(Countnr >= -1) SetTimer("Count", 1000, 0);    
    Countnr --;
    if(Countnr == -1) TextDrawSetString(CountTD, "~r~GO! ~y~GO! ~b~GO!");
    if(Countnr == -2) TextDrawHideForAll(CountTD);
    return true;

 

tu cu for ala pui la toti jucatorii de pe server cp, nu doar la cine vrei, daca vrei sa faci doar la cei doi, trebuie sa faci cum ti am zis eu mai sus

Link to comment
Share on other sites

  • 0
Acum 52 minute, AlexxAdv a spus:

tu cu for ala pui la toti jucatorii de pe server cp, nu doar la cine vrei, daca vrei sa faci doar la cei doi, trebuie sa faci cum ti am zis eu mai sus

Ok, tot eu sunt dar de pe alt cont, pai si daca fac cum ai spus tu, la onplayerenterracecheckpoint , daca pun for ala il dezactiveaza pentru amandoi ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.