[pomoc]Komande /sellgun i /sverca [materiajla]

Započeo milos depalov, Jul 12, 2011, 15:52:56 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

skripta koju kosrisitm: Empire-Gaming
detaljniji opis problema: Ocu da napravim komandu /sellgun da moze samo odredjena org da prodaje oruzija[4 org ima id 4,5,6 i 11 KAKO SAM VEC RADIO] i ,da odredjena organizacija [id 6]
deo skripte: //
slika ili video: //
nesto da dodate: evo vam ja sam probao nesto ali nece da mi prodaje i talje molim za pomoc  :(
if(strcmp(cmd,"/materials",true)==0)
   {
       if(IsPlayerConnected(playerid))
   {
   if (PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
{
   SendClientMessage(playerid,COLOR_GREY,"   You are not a Arms Dealer !");
   return 1;
}
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMessage(playerid, COLOR_WHITE, "KORISTENJE: /materials [name]");
SendClientMessage(playerid, COLOR_WHITE, "Available names: Get, Deliver.");
return 1;
}
if(strcmp(x_nr,"get",true) == 0)
{
   if(PlayerToPoint(3.0,playerid,597.1277,-1248.6479,18.2734))
   {
       if(MatsHolding[playerid] >= 10)
       {
           SendClientMessage(playerid, COLOR_GREY, "   You can't hold any more Materials Packages !");
       return 1;
       }
       tmp = strtok(cmdtext, idx);
       if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "KORISTENJE: /materials get [ammount]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 10) { SendClientMessage(playerid, COLOR_GREY, "   Package Number can't be below 1 or higher then 10 !"); return 1; }
new price = moneys * 100;
if(JB_GetPlayerMoney(playerid) > price)
{
   format(string, sizeof(string), "* You bought %d Materials Packages for $%d.", moneys, price);
   SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
   JB_GivePlayerMoney(playerid, - price);
   MatsHolding[playerid] = moneys;
}
else
{
   format(string, sizeof(string), "   You can't afford the $%d !", price);
   SendClientMessage(playerid, COLOR_GREY, string);
}
   }
   else
   {
       SendClientMessage(playerid, COLOR_GREY, "   You are not at the Materials Package Building in Los Santos !");
       return 1;
   }
}
else if(strcmp(x_nr,"deliver",true) == 0)
{
   if(PlayerToPoint(3.0,playerid, 2378.1841,-2016.0881,14.8329))
   {
       if(MatsHolding[playerid] > 0)
       {
           new payout = (50)*(MatsHolding[playerid]);
           format(string, sizeof(string), "* The Factory gave you %d Materials for your %d Materials Packages.", payout, MatsHolding[playerid]);
   SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
           PlayerInfo[playerid][pMats] += payout;
           MatsHolding[playerid] = 0;
       }
       else
       {
           SendClientMessage(playerid, COLOR_GREY, "   You don't have any Materials Packages !");
       return 1;
       }
   }
   else
   {
       SendClientMessage(playerid, COLOR_GREY, "   You are not at the Materials Factory in San Fierro !");
       return 1;
   }
}
else
{
   SendClientMessage(playerid, COLOR_GREY, "   Invalid Materials Name !");
   return 1;
}
}
return 1;
}
   if(strcmp(cmd,"/sellgun",true)==0)
   {
       if(IsPlayerConnected(playerid))//if (PlayerInfo[playerid][pMember] == 1
   {
    if (PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)// if (PlayerInfo[playerid][pJob] != 9)
{
   SendClientMessage(playerid,COLOR_GREY,"   You are not a Arms Dealer !");
   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_GRAD1, "KORISTENJE: /sellgun [playerid/DioImena] [weaponname]");
SendClientMessage(playerid, COLOR_GREY, "Weapons: flowers(25) sdpistol(100) eagle(150) mp5(200) shotgun(200)");
SendClientMessage(playerid, COLOR_GREY, "Weapons: ak47(600) m4(600) rifle (600)");
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, "*** Sell Guns ***");
SendClientMessage(playerid, COLOR_GREY, "KORISTENJE: /sellgun [playerid/DioImena] [weaponname]");
SendClientMessage(playerid, COLOR_GREY, "Weapons: flowers(25) sdpistol(100) eagle(200) mp5(200) shotgun(200)");
SendClientMessage(playerid, COLOR_GREY, "Weapons: ak47(600) m4(600) rifle(600)");
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
return 1;
}
}
//if(strcmp(x_weapon,"knife",true) == 0) { if(PlayerInfo[playerid][pMats] > 99) { weapon[playerid] = 4; price[playerid] = 100; ammo[playerid] = 1; PlayerInfo[giveplayerid][pGun1] = 4; PlayerInfo[giveplayerid][pAmmo1] = 1; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
if(strcmp(x_weapon,"sdpistol",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,"   Not enough Materials for that Weapon!"); return 1; } }
else if(strcmp(x_weapon,"flowers",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,"   Not enough Materials for that Weapon!"); return 1; } }
else if(strcmp(x_weapon,"eagle",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,"   Not enough Materials for that Weapon!"); 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,"   Not enough Materials for that Weapon!"); return 1; } }
else if(strcmp(x_weapon,"shotgun",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,"   Not enough Materials for that Weapon!"); return 1; } }
//else if(strcmp(x_weapon,"spas12",true) == 0) { if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 27; price[playerid] = 600; ammo[playerid] = 50; PlayerInfo[giveplayerid][pGun2] = 27; PlayerInfo[giveplayerid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); 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,"   Not enough Materials for that Weapon!"); 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,"   Not enough Materials for that Weapon!"); 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,"   Not enough Materials for that Weapon!"); return 1; } }
else { SendClientMessage(playerid,COLOR_GREY,"   Invalid Weapon name!"); return 1; }
if (ProxDetectorS(5.0, playerid, giveplayerid))
{
   if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GRAD1, "   You can not sell Guns to yourself!");
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), "   You have given %s, a %s with %d ammo, for %d Materials.", 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), "   You have recieved a %s with %d ammo from %s.", x_weapon, ammo[playerid], sendername);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s created a Gun from Materials, and hands it to %s.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
JB_GivePlayerWeapon(giveplayerid,weapon[playerid],ammo[playerid]);
PlayerInfo[playerid][pMats] -= price[playerid];
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   Your too far away.");
return 1;
}
}
else
{
format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
Poslednja Izmena: Jul 12, 2011, 19:08:30 POSLE PODNE od [TG]$--L84S--$

   if(strcmp(cmd,"/sellgun",true)==0)
    {
        if(IsPlayerConnected(playerid))
    {
     if (PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
{
    SendClientMessage(playerid,COLOR_GREY,"   You are not a Arms Dealer !");
    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_GRAD1, "KORISTENJE: /sellgun [playerid/DioImena] [weaponname]");
SendClientMessage(playerid, COLOR_GREY, "Weapons: flowers(25) sdpistol(100) eagle(150) mp5(200) shotgun(200)");
SendClientMessage(playerid, COLOR_GREY, "Weapons: ak47(600) m4(600) rifle (600)");
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, "*** Sell Guns ***");
SendClientMessage(playerid, COLOR_GREY, "KORISTENJE: /sellgun [playerid/DioImena] [weaponname]");
SendClientMessage(playerid, COLOR_GREY, "Weapons: flowers(25) sdpistol(100) eagle(200) mp5(200) shotgun(200)");
SendClientMessage(playerid, COLOR_GREY, "Weapons: ak47(600) m4(600) rifle(600)");
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
return 1;
}
}
//if(strcmp(x_weapon,"knife",true) == 0) { if(PlayerInfo[playerid][pMats] > 99) { weapon[playerid] = 4; price[playerid] = 100; ammo[playerid] = 1; PlayerInfo[giveplayerid][pGun1] = 4; PlayerInfo[giveplayerid][pAmmo1] = 1; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); return 1; } }
if(strcmp(x_weapon,"sdpistol",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,"   Not enough Materials for that Weapon!"); return 1; } }
else if(strcmp(x_weapon,"flowers",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,"   Not enough Materials for that Weapon!"); return 1; } }
else if(strcmp(x_weapon,"eagle",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,"   Not enough Materials for that Weapon!"); 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,"   Not enough Materials for that Weapon!"); return 1; } }
else if(strcmp(x_weapon,"shotgun",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,"   Not enough Materials for that Weapon!"); return 1; } }
//else if(strcmp(x_weapon,"spas12",true) == 0) { if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 27; price[playerid] = 600; ammo[playerid] = 50; PlayerInfo[giveplayerid][pGun2] = 27; PlayerInfo[giveplayerid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Materials for that Weapon!"); 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,"   Not enough Materials for that Weapon!"); 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,"   Not enough Materials for that Weapon!"); 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,"   Not enough Materials for that Weapon!"); return 1; } }
else { SendClientMessage(playerid,COLOR_GREY,"   Invalid Weapon name!"); return 1; }
if (ProxDetectorS(5.0, playerid, giveplayerid))
{
    if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GRAD1, "   You can not sell Guns to yourself!");
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), "   You have given %s, a %s with %d ammo, for %d Materials.", 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), "   You have recieved a %s with %d ammo from %s.", x_weapon, ammo[playerid], sendername);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "* %s created a Gun from Materials, and hands it to %s.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
JB_GivePlayerWeapon(giveplayerid,weapon[playerid],ammo[playerid]);
PlayerInfo[playerid][pMats] -= price[playerid];
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   Your too far away.");
return 1;
}
}
else
{
format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}