Jump to content
  • 0

Intrebare ShowPlayerDialog


FratziAdv

Question

Salut, am o intrebare despre functia ShowPlayerDialog. Cum faci ca atunci cand dai Close / Cancel / etc sa iti scoata un checkpoint sau sa anuleze ceva. de ex: faci o tura de job iar cand intri in ultimul checkpoint iti apare alt dialog. Daca vrei sa continui munca selectezi optiunea, daca nu, cand dai cancel sau close sa te scoata din vehicul sau sa iti opreasca munca. Intelegeti voi.

P.S: Am cautat pe wiki

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
11 minutes ago, WopsS said:

Te folosesti de functia RemovePlayerFromVehicle, DisablePlayerCheckpoint si setezi variabilele necesare in script-ul tau.

Vreau in felul urmator: Cand jucatorul da Cancel la dialog sa il scoata din vehicul.

Eu am jobul in felul urmator, mergi la un checkpoint, livrezi si dupa isi pune alt checkpoint de unde sa iti iei banii. Iar cand ajungi in checkpoint-ul din care iti iei banii iti apare dialog-ul respectiv. Iar cand dai cancel nu iti distruge vehiculul si eu vreau sa il distruga. Sper ca ai inteles.

Scriptul este urmatorul:

else if(truckLV[playerid] == 2)
    {
        new rand = random(10000); rand += 5000;
        TruckCash = rand;
        format(string, sizeof(string), "Ai primit $%s pentru livrarea facuta", FormatNumber(TruckCash));
        SCM(playerid, COLOR_GREEN, string);
        truckLV[playerid] = 0;
        truckWORK[playerid] = 0;
        DisablePlayerCheckpoint(playerid);
        GivePlayerCash(playerid, TruckCash);
        Update(playerid, pCashx);
        ShowPlayerDialog(playerid, DIALOG_TRUCK, DIALOG_STYLE_LIST, "Select destination:", "Casa 1\nCasa 2", "Select", "Cancel");
    }
Edited by FratziAdv
Link to comment
Share on other sites

  • 0

la ShowPlayerDialog, parametrul "response" este boolean (adica adevarat sau fals / 0 sau 1)

 

Quote

response               1 for left button and 0 for right button (if only one button shown, always 1)

ai zis ca te-ai uitat pe wiki... anyway,

La OnDialogResponse, verifici id-ul dialogului, si folosesti if sau switch pentru a vedea care este varianta alesa de player.

daca folosesti switch, iti recomand sa pui la default ceea ce ai pus la butonul de "cancel".

  • Upvote 1
Link to comment
Share on other sites

  • 0

Te duci la OnDialogResponse și vezi dacă ai:

if(dialogid == DIALOG_TRUCK)
{//}

Dacă ai, faci în felul următor:

if(dialogid == DIALOG_TRUCK)
{
	if(response)
	{
		//COD DUPĂ CE APASĂ BUTONUL 'Select'.
	}
	else
	{
		new masina = GetPlayerVehicleID(playerid);
        DestroyVehicle(masina);
	}
}

Dacă te-am ajutat, te rog să apeși pe butonul "/\", mulțumesc!

  • Upvote 1
Link to comment
Share on other sites

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.