Jump to content

/getlicense


TheSlim2

Recommended Posts

Salut @TheSlim2,

Poftim un exemplu foarte simplu:

1. definesti un nou dialog cu numele DIALOG_GET_LICENSES (sau cum vrei sa fie dialogu tau):
Exemplu la inceput de gm -> #define DIALOG_GET_LICENSES 999 sau daca le ai in enum, il adaugi acolo.

2. Comanda /getlicenses pe dialog, cea mai buna varianta.
YCMD:getlicenses( playerid, params[], help ) {
	ShowPlayerDialog( playerid, DIALOG_GET_LICENSES, DIALOG_STYLE_TABLIST_HEADERS, "Get licenses", "type\tprice\nDriving Licence\t$100,000\nGun Licence\t$300,000", "Buy", "Close" );
	return true; }

3. la OnDialogResponse adaugi noul dialog
case DIALOG_GET_LICENSES: {
  if( !response ) return true;
  switch( listitem ) {
    case 0: {
    	PlayerInfo[ playerid ][ pCarLicence ] = 100;
    }
    case 1: {
    	PlayerInfo[ playerid ][ pGunLicence ] = 100;
    }
    case 2: {
    	//etc
    }
  }
}

Ce iti mai ramane de facut e sa iti adaugi mesajele, sa inlocuiesti variabilele pCarLicence, pGunLicence, etc cu variabilele tale pentru licente, sa faci salvarea lor in baza de date cu functia din gamemodeul tau (Exemplu, pe burned era parca functia 'Update') si sa adaugi restul de licente in comanda /getlicenses si in dialog, dupa exemplu pe care ti l-am oferit.

 

In cazul in care gamemodeul tau nu foloseste switch in dialoguri, adica daca ai spre exemplu la OnDialogResponse, dialogurile in felul urmator:

if(dialogid == DIALOG_CEVA) {

}
else if(dialogid == DIALOG_ALTCEVA) {

}

Atunci, in loc de "case DIALOG_GET_LICENSES:" vei folosi -> if( dialogid == DIALOG_GET_LICENSES ) sau else if( dialogid == DIALOG_GET_LICENSES)

 

In cazul in care gamemodeul tau nu e pe YCMD (adica daca comenzile tale sunt asa-> CMD:ceva(playerid, params[]), in loc de YCMD:ceva(playerid, params[], help), atunci comanda /getlicenses va arata asa -> CMD:getlicenses( playerid, params[] )

Edited by shane

Daca te-am ajutat =>

spacer.png

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.