Heya,
habe mir vor ca. einer Stunde einen kleinen /ammo CMD erstellt, der die momentan ausgewählte Waffe mit so oder so viel Patronen füllen soll, wobei der Spieler aber 500$ abdrücken muss.
Alles klappt, kein Error, jedoch ist es ingame nur Schrott - es zeigt mir bei JEDER Waffe den Text für die Melee-Waffen an.
if (strcmp("/ammo", cmdtext, true, 10) == 0)
{
new pMoney, pWeapon;
pMoney = GetPlayerMoney(playerid);
pWeapon = GetPlayerWeapon(playerid);
if(pMoney == 500 || pMoney > 500){
if (GetPlayerWeapon(playerid) == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15){
SendClientMessage(playerid,COLOR_RED,"You can't buy ammo for a melee weapon!");
}else if(GetPlayerWeapon(playerid) == 16 || 17 || 18){
GivePlayerWeapon(playerid,pWeapon,5);
SendClientMessage(playerid,COLOR_GREEN,"You successfully bought 5 peaces of your current weapon!");
}else if(GetPlayerWeapon(playerid) == 22 || 23){
GivePlayerWeapon(playerid,pWeapon,75);
SendClientMessage(playerid,COLOR_GREEN,"You successfully bought 75 cartridges for your pistol!");
}else if(GetPlayerWeapon(playerid) == 24){
GivePlayerWeapon(playerid,pWeapon,20);
SendClientMessage(playerid,COLOR_GREEN,"You successfully bought 20 cartridges for your deagle!");
}else if(GetPlayerWeapon(playerid) == 25 || 26 || 27){
GivePlayerWeapon(playerid,pWeapon,20);
SendClientMessage(playerid,COLOR_GREEN,"You successfully bought 20 cartridges for your shotgun!");
}else if(GetPlayerWeapon(playerid) == 28 || 29 || 32){
GivePlayerWeapon(playerid,pWeapon,85);
SendClientMessage(playerid,COLOR_GREEN,"You successfully bought 285 cartridges for your SMG!");
}else if(GetPlayerWeapon(playerid) == 30 || 31){
GivePlayerWeapon(playerid,pWeapon,65);
SendClientMessage(playerid,COLOR_GREEN,"You successfully bought 65 cartridges for your AK-47 / M4!");
}else{
SendClientMessage(playerid,COLOR_RED,"The Administrator disabled /ammo for this weapon!");
}
}
return 1;
}
Ich habe mal stark die Vermutung, dass das ganze nicht funktioniert, da pWeapon nicht richtig geupdated wird.(Ja, ich weiß, dass man die new's direkt zuweißen kann, jedoch habe ich etwas ausprobiert. )