Hallo,
ich mahc garde ein /givegun befehl für die Waffen Dealer, jedoch geht es nicht ordentlich. An folgender stelle versagt das script:
ZitatAlles anzeigenif(gun == 1){ if(PlayerInfo[playerid][pMats] >= 25){ gunID = 14; matsp = 25; }}
if(gun == 2){ if(PlayerInfo[playerid][pMats] >= 100){ gunID = 23; matsp = 100; }}
if(gun == 3){ if(PlayerInfo[playerid][pMats] >= 200){ gunID = 24; matsp = 200; }}
if(gun == 4){ if(PlayerInfo[playerid][pMats] >= 200){ gunID = 29; matsp = 200; }}
if(gun == 5){ if(PlayerInfo[playerid][pMats] >= 200){ gunID = 25; matsp = 200; }}
if(gun == 6){ if(PlayerInfo[playerid][pMats] >= 200){ gunID = 30; matsp = 200; }}
if(gun == 7){ if(PlayerInfo[playerid][pMats] >= 600){ gunID = 31; matsp = 600; }}
if(gun == 8){ if(PlayerInfo[playerid][pMats] >= 600){ gunID = 33; matsp = 600; }}
jedoch geht das hier :
Zitat
if(gun <= 0){ return SendClientMessage(playerid, COLOR_GRAD2,"Falsche Waffen ID");}
if(gun >= 9){ return SendClientMessage(playerid, COLOR_GRAD2,"Falsche Waffen ID");}
Naja ich weiß nicht warum wen ich /givegun 0 8 100 0 eingebe steht dort folgendes
ZitatDu hast nun eine 0 - 8.
und wen ich /givegun 0 10 100 0eingebe steht da
ZitatFalsche Waffen ID
hier das ganze script einmal :
ZitatAlles anzeigendcmd_givegun(playerid,params[])
{
new coordsstring[256];
new pID;
new gun;
new muni;
new preis;
if (PlayerInfo[playerid][pJob] == 2)
{
if(!strlen(params))
{
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
SendClientMessage(playerid, COLOR_WHITE, "*** Waffen ***");
SendClientMessage(playerid, COLOR_RED, "Verwendung: /givegun [ID] [WAFFEN ID] [AMMO] [PREIS]");
SendClientMessage(playerid, COLOR_GRAD5, "Waffen: 1.flowers(25) 2.sdpistol(100) 3.eagle(200) 4.mp5(200) 5.shotgun(200)");
SendClientMessage(playerid, COLOR_GRAD5, "Waffen: 6.ak47(600) 7.m4(600) 8.rifle(600)");
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
}
if(sscanf(params,"uddd",pID,gun,muni,preis)){
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
SendClientMessage(playerid, COLOR_WHITE, "*** Waffen ***");
SendClientMessage(playerid, COLOR_RED, "Verwendung: /givegun [ID] [WAFFEN ID] [AMMO] [PREIS]");
SendClientMessage(playerid, COLOR_GRAD5, "Waffen: 1.flowers(25) 2.sdpistol(100) 3.eagle(200) 4.mp5(200) 5.shotgun(200)");
SendClientMessage(playerid, COLOR_GRAD5, "Waffen: 6.ak47(600) 7.m4(600) 8.rifle(600)");
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
}
new pID=strval(params);
if(!IsPlayerConnected(pID))
{
return SendClientMessage(playerid,0xFFFF00AA,"Dieser Spieler ist nicht Online!");
}
new gunID;
new matsp;
if(PlayerInfo[pID][pMoney] == '0'){
return SendClientMessage(playerid, COLOR_GRAD2,"Dieser Spieler hat keinen Geld");
}else{
if(gun == 1){ if(PlayerInfo[playerid][pMats] >= 25){ gunID = 14; matsp = 25; }}
if(gun == 2){ if(PlayerInfo[playerid][pMats] >= 100){ gunID = 23; matsp = 100; }}
if(gun == 3){ if(PlayerInfo[playerid][pMats] >= 200){ gunID = 24; matsp = 200; }}
if(gun == 4){ if(PlayerInfo[playerid][pMats] >= 200){ gunID = 29; matsp = 200; }}
if(gun == 5){ if(PlayerInfo[playerid][pMats] >= 200){ gunID = 25; matsp = 200; }}
if(gun == 6){ if(PlayerInfo[playerid][pMats] >= 200){ gunID = 30; matsp = 200; }}
if(gun == 7){ if(PlayerInfo[playerid][pMats] >= 600){ gunID = 31; matsp = 600; }}
if(gun == 8){ if(PlayerInfo[playerid][pMats] >= 600){ gunID = 33; matsp = 600; }}
if(gun <= 0){ return SendClientMessage(playerid, COLOR_GRAD2,"Falsche Waffen ID");}
if(gun >= 9){ return SendClientMessage(playerid, COLOR_GRAD2,"Falsche Waffen ID");}
PlayerInfo[playerid][pMats] -= matsp;
GivePlayerWeapon(pID,gunID,muni);
GivePlayerMoney(pID, -preis);
GivePlayerMoney(playerid, preis);
format(coordsstring, sizeof(coordsstring),"Du hast nun eine %d - %d.",gunID, gun);
SendClientMessage(playerid, COLOR_GREEN,coordsstring);
}
return 1;
}
else return SendClientMessage(playerid, COLOR_RED,"Du bist Kein Händler!");
}