Jump to content

CristianLMAO

Recommended Posts

Salut!

Astazi o sa va prezint primul meu sistem pus pe acest site, si o sa va explic ce face fiecare lucru.

Hai sa incepem.

Sistemul arata cam asa:

sa-mp-009.thumb.png.aefbd7dc25211d0db00c52baed66f817.png

(dialogul este pozitionat mai in drapta din cauza rezolutiei mele)

IMPORTANT:

IN CODUL DE MAI JOS ESTE DECAT CE MAI TREBUIE ADAUGAT, NU TOT GAMEMODUL!!

TUTORIAL:

 

//punem include-urile care ne trebuie la acest sistem

#include <zcmd>

 

//prima data facem o comanda, dar atentie, ACEASTA COMANDA O POATE FOLOSI ORICINE, daca doriti ca doar admini sa o poata folosi, folositi comanda hasurata!

CMD:v(playerid, params[]){
    ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "Spawn car", "Write your car id: (Min. 400 / Max. 611)", "Spawn", "Close"); //cand scriem "/v" apare acest dialog
    return 1;
}

//DACA DORITI SA FIE COMANDA ASTA ACCESIBILA DOAR LA ADMIN:
//CMD:v(playerid, params[]){
//
//	if (IsPlayerAdmin(playerid)) // daca jucatorul este admin:
//    {
//    	ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "Spawn car", "Write your car id: (Min. 400 / Max. 611)", "Spawn", "Close"); //cand scriem "/v" apare acest dialog    
//    }
//    else{ //daca nu:
//    	SendClientMessage(playerid, 0xFF000090, "You're not admin!");
//    }
//    return 1;
//}

 

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
    if(dialogid == 1){ // cand raspunde la dialogul cu id-ul 1 se intampla asta:
    
    	if(!response) return SendClientMessage(playerid, 0xFF000099, "You closed the menu!"); // daca apasa pe butonul de inchidere, acest meniu o sa se inchida.
        if(strval(inputtext) < 400) return SendClientMessage(playerid, 0xFF000099, "Your car id is under 400!"); // Daca id-ul scris este mai mic de 400 o sa scrie asta
        if(strval(inputtext) > 611) return SendClientMessage(playerid, 0xFF000099, "Your car id is over 611!"); // Daca id-ul scris este mai mare de 611 o sa scrie asta
        
        // inputtext inseamna ce a scris jucatorul in text-box.
        new Float:X;
        new Float:Y;
        new Float:Z;

        GetPlayerPos(playerid,X,Y,Z); // aici seteaza valoarea lui X, Y si Z in coordonatele juactorului
        CreateVehicle(strval(inputtext),X,Y+5,Z,1,1,1,90000); //spawneaza masina cu id-ul din textbox, la coordonatele playerului
        return 1;
    }
}

 

Daca este sa fi omis ceva, sau daca doriti sa imbunatatesc acest sistem, puteti spune in comentarii.

Edited by CristianLMAO
Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

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

Guest
Reply to this topic...

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