16.06.2018, 00:28
I have a dialog command to display a list of driftcar.
/driftcar command
ondialogresponse
And if I type the command /driftcar again old vehicle will be destroyed, how to make like this?
/driftcar command
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/driftcar", cmdtext, true, 10) == 0) { ShowPlayerDialog(playerid, DIALOG_DRIFTCAR, DIALOG_STYLE_LIST, "Drift Car", "Elegy\nSultan\nBuffalo", "Select", "Exit"); return 1; } return 0; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_DRIFTCAR) { if(response) { switch(listitem) { case 0: { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); new elegy = AddStaticVehicleEx (562, x, y, z, 0.0, -1, -1, 30); PutPlayerInVehicle(playerid, elegy, 0); } case 1: { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); new sultan = AddStaticVehicleEx (560, x, y, z, 0.0, -1, -1, 30); PutPlayerInVehicle(playerid, sultan, 0); } case 2: { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); new buffalo = AddStaticVehicleEx (402, x, y, z, 0.0, -1, -1, 30); PutPlayerInVehicle(playerid, buffalo, 0); } } } return 1; } return 0; }