1. Wie gesagt.
2. Ich habe es gerade bei mir lokal getestet, so funktioniert es:
ocmd:sweapons(playerid,params[])
{
new pID;
if(!isPlayerAnAdmin(playerid,1))return SendClientMessage(playerid,0xFFFFFFFF,"Hmhmh");
if(sscanf(params,"u",pID)) return SendClientMessage(playerid,0xFFFFFFFF,"Blub");
if(!IsPlayerConnected(pID))return SendClientMessage(playerid,0xFFFFFFFF,"Bla");
new bullets[13];
new curweapons[13];
for(new i = 0; i < 12; i++)
{
GetPlayerWeaponData(pID, i+1, curweapons[i], bullets[i]);
}
new string1[60],string2[60],string3[60],string4[60],string5[60],string6[60],string7[60],string8[60],string9[60],string10[60],string11[60],string12[60],string13[60],rest[800];
format(string1, sizeof string1, "Waffen von: %s (Id: %d)",SpielerName(pID),pID);
format(string2, sizeof string2, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[1]],curweapons[1],bullets[1]);
format(string3, sizeof string3, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[2]],curweapons[2],bullets[2]);
format(string4, sizeof string4, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[3]],curweapons[3],bullets[3]);
format(string5, sizeof string5, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[4]],curweapons[4],bullets[4]);
format(string6, sizeof string6, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[5]],curweapons[5],bullets[5]);
format(string7, sizeof string7, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[6]],curweapons[6],bullets[6]);
format(string8, sizeof string8, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[7]],curweapons[7],bullets[7]);
format(string9, sizeof string9, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[8]],curweapons[8],bullets[8]);
format(string10, sizeof string10, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[9]],curweapons[9],bullets[9]);
format(string11, sizeof string11, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[10]],curweapons[10],bullets[10]);
format(string12, sizeof string12, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[11]],curweapons[11],bullets[11]);
format(string13, sizeof string13, "%s (WpnId: %d) (Munition: %i)",Waffenname[curweapons[12]],curweapons[12],bullets[12]);
format(rest, sizeof rest, "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", string1,string2,string3,string4,string5,string6,string7,string8,string9,string10,string11,string12,string13);
ShowPlayerDialog(playerid,WEAPON_DIA,DIALOG_STYLE_MSGBOX,"Waffen:",rest,"Ok","");
return 1;
}
Undzwar trat dieser Fehler aus folgendem Grund auf:
Wenn der Spieler keine Waffe hat, dann ist die Waffenid und somit curweapons[x] 0.
Die Mathematik besagt, dass 0 - 1 = -1 ist.
Und einem Array kann logischerweise keine negative Zahl übergeben werden.
(Waffenname[-1] exisitiert nicht).
Füge bei deinem Waffennamen Array an erster Stelle am besten einfach "Keine" ein:
new Waffenname[][] =
{
"Keine","Schlagringe","Golfschläger","Schlagstock","Messer","Baseballschläger","Schaufel","Poolstock","Katana","Kettensege",
"Dildo","Dildo","Vibrator","Vibrator","Blumen","Gehstock","Granate","Tränengas","Molotov-Cocktail","xxxx","xxxx","xxxx","Pistole","schallgedämpfte Pistole","Desert Eagle","Schrotflinte","abgesägte Schrotflinte","automatische Schrotflinte",
"UZI","MP5","AK 47","M4","TEC9","Rifle","Sniper","Raketenwerfer","Bazuka","Flammenwerfer","Minigun","Auslöser","Rucksackbombe","Farbspray","Feuerlöscher","Kamera","XXXX","XXXX","Fallschirm"
};
BlackLegend