Ich wollte mal fragen ob jemand mir es so machen könnte /sellgun [weapon] [id] [preis]
und dann /accept weapon
if(strcmp(cmd,"/sellgun",true)==0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pJob] != 9)
{
SendClientMessage(playerid,COLOR_GREY," Du bist kein Waffenhändler!");
return 1;
}
new x_weapon[256],weapon[MAX_PLAYERS],ammo[MAX_PLAYERS],price[MAX_PLAYERS];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
SendClientMessage(playerid, COLOR_WHITE, "*** Waffen ***");
SendClientMessage(playerid, COLOR_GREY, "Benutze: /sellgun [playerid/PartOfName] [weaponname]");
SendClientMessage(playerid, COLOR_GREY, "Waffen: Blumen(25) sPistole(100) Deagle(200) MP5(200) Schrotflinte(200)");
SendClientMessage(playerid, COLOR_GREY, "Waffen: AK47(600) M4(600) Rifle(600)");
SendClientMessage(playerid, COLOR_GREY, " Angaben in den Klammern sind die erforderlichen Mats.");
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
x_weapon = strtok(cmdtext, idx);
if(!strlen(x_weapon))
{
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
SendClientMessage(playerid, COLOR_WHITE, "*** Waffen ***");
SendClientMessage(playerid, COLOR_GREY, "Benutze: /sellgun [playerid/PartOfName] [weaponname]");
SendClientMessage(playerid, COLOR_GREY, "Waffen: Blumen(25) sPistole(100) Deagle(200) MP5(200) Schrotflinte(200)");
SendClientMessage(playerid, COLOR_GREY, "Waffen: AK47(600) M4(600) Rifle(600)");
SendClientMessage(playerid, COLOR_GREY, " Angaben in den Klammern sind die erforderlichen Mats.");
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
return 1;
}
}
if(strcmp(x_weapon,"sPistole",true) == 0) { if(PlayerInfo[playerid][pMats] > 99) { weapon[playerid] = 23; price[playerid] = 100; ammo[playerid] = 50; PlayerInfo[giveplayerid][pGun2] = 23; PlayerInfo[giveplayerid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY," Du hast nicht genügend Mats für die schallgedämpfte Pistole!"); return 1; } }
else if(strcmp(x_weapon,"Blumen",true) == 0) { if(PlayerInfo[playerid][pMats] > 24) { weapon[playerid] = 14; price[playerid] = 25; ammo[playerid] = 1; PlayerInfo[giveplayerid][pGun1] = 14; PlayerInfo[giveplayerid][pAmmo1] = 1; } else { SendClientMessage(playerid,COLOR_GREY," Du hast nicht genügend Mats für die Blumen!"); return 1; } }
else if(strcmp(x_weapon,"Deagle",true) == 0) { if(PlayerInfo[playerid][pMats] > 199) { weapon[playerid] = 24; price[playerid] = 150; ammo[playerid] = 50; PlayerInfo[giveplayerid][pGun2] = 24; PlayerInfo[giveplayerid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY," Du hast nicht genügend Mats für die Deagle!"); return 1; } }
else if(strcmp(x_weapon,"MP5",true) == 0) { if(PlayerInfo[playerid][pMats] > 199) { weapon[playerid] = 29; price[playerid] = 200; ammo[playerid] = 200; PlayerInfo[giveplayerid][pGun2] = 29; PlayerInfo[giveplayerid][pAmmo2] = 200; } else { SendClientMessage(playerid,COLOR_GREY," Du hast nicht genügend Mats für die MP5!"); return 1; } }
else if(strcmp(x_weapon,"Schrotflinte",true) == 0) { if(PlayerInfo[playerid][pMats] > 199) { weapon[playerid] = 25; price[playerid] = 200; ammo[playerid] = 50; PlayerInfo[giveplayerid][pGun2] = 25; PlayerInfo[giveplayerid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY," Du hast nicht genügend Mats für die Schrotflinte!"); return 1; } }
else if(strcmp(x_weapon,"AK47",true) == 0) { if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 30; price[playerid] = 600; ammo[playerid] = 250; PlayerInfo[giveplayerid][pGun2] = 30; PlayerInfo[giveplayerid][pAmmo2] = 250; } else { SendClientMessage(playerid,COLOR_GREY," Du hast nicht genügend Mats für die AK47!"); return 1; } }
else if(strcmp(x_weapon,"M4",true) == 0) { if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 31; price[playerid] = 600; ammo[playerid] = 250; PlayerInfo[giveplayerid][pGun2] = 31; PlayerInfo[giveplayerid][pAmmo2] = 250; } else { SendClientMessage(playerid,COLOR_GREY," Du hast nicht genügend Mats für die M4!"); return 1; } }
else if(strcmp(x_weapon,"Rifle",true) == 0) { if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 33; price[playerid] = 600; ammo[playerid] = 50; PlayerInfo[giveplayerid][pGun2] = 33; PlayerInfo[giveplayerid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY," Du hast nicht genügend Mats für die Rifle!"); return 1; } }
else { SendClientMessage(playerid,COLOR_GREY," Falscher Waffenname!"); return 1; }
if (ProxDetectorS(5.0, playerid, giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GRAD1, " Du kannst dir nicht selber Waffen geben!");
return 1;
}
if(PlayerInfo[playerid][pMiserPerk] > 0)
{
new skill = 2 * PlayerInfo[playerid][pMiserPerk];
new mats = price[playerid] / 100;
price[playerid] -= (mats)*(skill);
}
ConsumingMoney[playerid] = 1;
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), " Du hast %s, eine %s mit %d Munition, für %d verkauft.", giveplayer,x_weapon, ammo[playerid], price[playerid]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), " Du hast eine %s mit %d Munition von %s erhalten.", x_weapon, ammo[playerid], sendername);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s übergibt an %s eine Waffe.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GivePlayerWeapon(giveplayerid,weapon[playerid],ammo[playerid]);
PlayerInfo[playerid][pMats] -= price[playerid];
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Der Spieler ist zu weit weg!");
return 1;
}
}
else
{
format(string, sizeof(string), " %d ist kein aktiver Spieler.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}