So bad_company ich hoffe du bist zufrieden damit, hab mir extra Mühe gemacht so schön wie möglich zu Scripten für dich
#include <a_samp>
#define Ammunationdialog (56748) //Die ID vom Dialog
#define Ammunationdialogtext ("Nahkampfwaffen\nSchusswaffen\nSonstiges")
#define COLOR_GREY (0xFFFFFFAA)
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/ammunation", cmdtext, true, 10) == 0)
{
SetPVarInt(playerid, "AmmuDialogNummer", 0);
SetPVarInt(playerid, "AmmuWaffenChosen", 0);
return ShowPlayerDialog(playerid, Ammunationdialog, DIALOG_STYLE_LIST, "AmmuNation", Ammunationdialogtext, "Weiter", "Abbrechen");
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == Ammunationdialog)
{
new string[512], cache[64];
switch(GetPVarInt(playerid, "AmmuDialogNummer"))
{
case 0:
{
if(!response)
{
DeletePVar(playerid, "AmmuDialogNummer");
DeletePVar(playerid, "AmmuWaffenChosen");
return SendClientMessage(playerid, COLOR_GREY, "Danke für deinen Besuch...");
}
SetPVarInt(playerid, "AmmuDialogNummer", GetPVarInt(playerid, "AmmuDialogNummer")+listitem+1);
switch(listitem)
{
case 0: ShowPlayerDialog(playerid, Ammunationdialog, DIALOG_STYLE_LIST, "AmmuNation", "Messer\nBaseballschläger", "Auswählen", "Zurück");
case 1: ShowPlayerDialog(playerid, Ammunationdialog, DIALOG_STYLE_LIST, "AmmuNation", "MP5\nAK47", "Auswählen", "Zurück");
case 2: ShowPlayerDialog(playerid, Ammunationdialog, DIALOG_STYLE_MSGBOX, "AmmuNation", "Es fällt mir nix Sonstiges ein ^^", "Ok xD", "Schade...");
}
}
case 1,2: //Nahkampfwaffen
{
if(!response)
{
SetPVarInt(playerid, "AmmuDialogNummer", 0);
return ShowPlayerDialog(playerid, Ammunationdialog, DIALOG_STYLE_LIST, "AmmuNation", Ammunationdialogtext, "Weiter", "Abbrechen");
}
if(GetPVarInt(playerid, "AmmuDialogNummer") == 1) {
switch(listitem)
{
case 0: SetPVarInt(playerid, "AmmuWaffenChosen", 4); //Messer
case 1: SetPVarInt(playerid, "AmmuWaffenChosen", 5); //Baseball
}}
else if(GetPVarInt(playerid, "AmmuDialogNummer") == 2) {
switch(listitem)
{
case 0: SetPVarInt(playerid, "AmmuWaffenChosen", 29); //MP5
case 1: SetPVarInt(playerid, "AmmuWaffenChosen", 30); //AK-47
}}
SetPVarInt(playerid, "AmmuDialogNummer", 4);
GetWeaponName(GetPVarInt(playerid, "AmmuWaffenChosen"), cache, sizeof(cache));
format(string, sizeof(string), "Wieviel Magazin von der %s möchtest du nehmen?", cache);
return ShowPlayerDialog(playerid, Ammunationdialog, DIALOG_STYLE_INPUT, "AmmuNation", string, "Nehmen", "Zurück");
}
case 3:
{
SetPVarInt(playerid, "AmmuDialogNummer", 0);
return ShowPlayerDialog(playerid, Ammunationdialog, DIALOG_STYLE_LIST, "AmmuNation", Ammunationdialogtext, "Weiter", "Abbrechen");
}
case 4:
{
if(!response)
{
SetPVarInt(playerid, "AmmuDialogNummer", 0);
return ShowPlayerDialog(playerid, Ammunationdialog, DIALOG_STYLE_LIST, "AmmuNation", Ammunationdialogtext, "Weiter", "Abbrechen");
}
new ammo = strval(inputtext), slot = 0, wdata[2], wname[MAX_PLAYER_NAME];
if(ammo < 0 || ammo > 99999) format(string, sizeof(string), "Ungültige Magazins Zahl!\nWieviel Magazin von der %s möchtest du nehmen?", cache);
else
{
SetPVarInt(playerid, "AmmuDialogNummer", 3);
GivePlayerWeapon(playerid, GetPVarInt(playerid, "AmmuWaffenChosen"), ammo);
GetWeaponName(GetPVarInt(playerid, "AmmuWaffenChosen"), cache, MAX_PLAYER_NAME);
format(string, sizeof(string), "Du hast dir eine %s mit %d Magazin genommen!\nDu besitzt derzeit an folgendem Waffenarsenal:\n", cache, ammo);
for(; slot != 13; slot++)
{
GetPlayerWeaponData(playerid, slot, wdata[0], wdata[1]);
GetWeaponName(wdata[0], wname, sizeof(wname));
format(cache, sizeof(cache), "\t-> %s (%d Magazin)\n", wname, wdata[1]);
strcat(string, cache);
}
return ShowPlayerDialog(playerid, Ammunationdialog, DIALOG_STYLE_MSGBOX, "AmmuNation", string, " ", "Weiter");
}
}
}
}
return 1;
}