Код:
CMD:minigundm(playerid,params[])
{
ShowPlayerDialog(playerid, DIALOG_TELEPORTMINIGUNDM, DIALOG_STYLE_MSGBOX, "Are you sure?", "Are you sure you want to go to the minigun dm?", "yes", "no");
return 1;
}
// Random Spawn MINIGUNDM
new Float:minigundm[4][4] =
{
{1545.6646,62.1403,26.8042},{1572.6780,21.4045,24.1641},
{1548.0972,-29.7529,21.3138},{1507.9283,23.7666,24.1406}
};
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_TELEPORTMINIGUNDM)
{
if(response)
{
SCM(playerid, COULEUR_ROUGE,"You've been sended in minigundm tape /stopdm to stop dm");
new MD = random(sizeof(minigundm));
SetPlayerPos(playerid, minigundm[MD][0], minigundm[MD][1], minigundm[MD][2]);
new Name[24];
new string[128];
GivePlayerWeapon(playerid, 38, 500);
GetPlayerName(playerid, Name, sizeof(Name));
format(string, sizeof(string),"The Player %s has joined the minigundm!", Name);
SendClientMessageToAll(COULEUR_BLEU, string);
return true;
}
else
{
SCM(playerid, COULEUR_ROUGE, "You have been not teleported to minigundm, tape /cmdsdm if you want search other dm area");
}
}
return 0;
}
// command /meleedm
CMD:meleedm(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_TELEPORTMINIGUNDM, DIALOG_STYLE_MSGBOX, "Are you sure?", "Are you sure you want to go to the melee dm?", "yes", "no");
return 1;
}
// RANDOM SPAWN MELEEDM
new Float:meleedm[4][4] =
{
{270.4182,1840.2594,6.6778},{239.6006,1845.0941,8.7578},
{239.1858,1858.0815,14.0840},{256.4077,1801.2529,7.5228}
};
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_MELEEDM)
{
if(response)
{
SCM(playerid, COULEUR_ROUGE,"You've been sended in minigundm tape /stopdm to stop dm");
new MeD = random(sizeof(meleedm));
SetPlayerPos(playerid, meleedm[MeD][0], meleedm[MeD][1], meleedm[MeD][2]);
new Name[24];
new string[128];
GivePlayerWeapon(playerid, 38, 500);
GetPlayerName(playerid, Name, sizeof(Name));
format(string, sizeof(string),"The Player %s has joined the minigundm!", Name);
SendClientMessageToAll(COULEUR_BLEU, string);
return true;
}
else
{
SCM(playerid, COULEUR_ROUGE, "You have been not teleported to meleedm, tape /cmdsdm if you want search other dm area");
}
}
return 0;
}
Using switch is faster than multiple if/else if statements. It doesn't really make any difference right now as he does not have many dialogs but it's a good practice anyway.