16.10.2011, 18:37
Hello guys
Im gonna To fix Raven's Bug and problems .
i Changed arms dealer job to a Side job.
For create a Gun you should Type /creategun [PlayerId/Playername] [Weapon name]
I want change it to /creategun [Weapon name]
When you use /creategun you cant make a Gun for Everyone is near you But i want make Just for Himself
This is the Code:
Im gonna To fix Raven's Bug and problems .
i Changed arms dealer job to a Side job.
For create a Gun you should Type /creategun [PlayerId/Playername] [Weapon name]
I want change it to /creategun [Weapon name]
When you use /creategun you cant make a Gun for Everyone is near you But i want make Just for Himself
This is the Code:
PHP код:
if(strcmp(cmd,"/creategun",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerInRangeOfPoint(playerid, 2, 2288.28,-1104.93,38.33) || IsPlayerInRangeOfPoint(playerid, 2, 723.23,-1495.88,1.93))
{
SendClientMessage(playerid, COLOR_RED, " {881A0C}You are not at the Gun Factory !");
return 1;
}
new x_weapon[128],weapon[MAX_PLAYERS],ammo[MAX_PLAYERS],price[MAX_PLAYERS];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
if(PlayerInfo[playerid][pRegularRank] == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "{881A0C}USAGE: /creategun [playerid/PartOfName] [weaponname]");
SendClientMessage(playerid, COLOR_GREY, "{881A0C}Weapons: knife(50) bat(25) flowers(25) silenced(100) deagle (225) Molotovs (800)");
SendClientMessage(playerid, COLOR_GREY, "{881A0C}Weapons: mp5(350) combat (600) shotgun(200) ak47(500) m4(650) country (450)");
SendClientMessage(playerid, COLOR_GREY, "{881A0C}Weapons: TEC9(200) MAC10 (275) Sniper(800) Colt45(125) sawnoff(300) RPG (1000)");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "{881A0C}USAGE: /creategun [playerid/PartOfName] [weaponname]");
SendClientMessage(playerid, COLOR_GREY, "{881A0C}Weapons: knife(50) bat(25) flowers(25) silenced(100) deagle (225) Molotovs (800)");
SendClientMessage(playerid, COLOR_GREY, "{881A0C}Weapons: mp5(350) combat (600) shotgun(200) ak47(500) m4(650) country (450)");
SendClientMessage(playerid, COLOR_GREY, "{881A0C}Weapons: TEC9(200) MAC10 (275) Sniper(800) Colt45(125) sawnoff(300) RPG (1000)");
return 1;
}
}
giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
x_weapon = strtok(cmdtext, idx);
if(!strlen(x_weapon))
{
if(PlayerInfo[playerid][pRegularRank] == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /creategun [playerid/PartOfName] [weaponname]");
SendClientMessage(playerid, COLOR_GREY, "Weapons: knife(50) bat(25) flowers(25) silenced(100) deagle (225) Molotovs (800)");
SendClientMessage(playerid, COLOR_GREY, "Weapons: mp5(350) combat (600) shotgun(200) ak47(500) m4(650) country (450)");
SendClientMessage(playerid, COLOR_GREY, "Weapons: TEC9(200) MAC10 (275) Sniper(800) Colt45(125) sawnoff(300) RPG (1000)");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /creategun [playerid/PartOfName] [weaponname]");
SendClientMessage(playerid, COLOR_GREY, "Weapons: knife(50) bat(25) flowers(25) silenced(100) deagle (225) Molotovs (800)");
SendClientMessage(playerid, COLOR_GREY, "Weapons: mp5(350) combat (600) shotgun(200) ak47(500) m4(650) country (450)");
SendClientMessage(playerid, COLOR_GREY, "Weapons: TEC9(200) MAC10 (275) Sniper(800) Colt45(125) sawnoff(300) RPG (1000)");
return 1;
}
}
}
if(strcmp(x_weapon,"knife",true) == 0)
{
if(PlayerInfo[playerid][pMats] > 49)
{
weapon[playerid] = 4;
price[playerid] = 50;
ammo[playerid] = 1;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"bat",true) == 0)
{
if(PlayerInfo[playerid][pMats] > 24)
{
weapon[playerid] = 5;
price[playerid] = 25;
ammo[playerid] = 1;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"silenced",true) == 0)
{
if(PlayerInfo[playerid][pMats] > 99)
{
weapon[playerid] = 23;
price[playerid] = 100;
ammo[playerid] = 110;
}
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;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"deagle",true) == 0)
{
if(PlayerInfo[playerid][pMats] > 224)
{
weapon[playerid] = 24;
price[playerid] = 225;
ammo[playerid] = 175;
}
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] > 349)
{
weapon[playerid] = 29;
price[playerid] = 350;
ammo[playerid] = 325;
}
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] = 250;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"combat",true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 15,1484.3933,-1731.2124,6.7213))
{
SendClientMessage(playerid, COLOR_GREY, "** You can sell this gun only at black market !");
return 1;
}
if(PlayerInfo[playerid][pMats] > 599)
{
weapon[playerid] = 27;
price[playerid] = 600;
ammo[playerid] = 350;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"ak47",true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 15,1484.3933,-1731.2124,6.7213))
{
SendClientMessage(playerid, COLOR_GREY, "** You can sell this gun only at black market !");
return 1;
}
if(PlayerInfo[playerid][pMats] > 499)
{
weapon[playerid] = 30;
price[playerid] = 500;
ammo[playerid] = 400;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"m4",true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 15,1484.3933,-1731.2124,6.7213))
{
SendClientMessage(playerid, COLOR_GREY, "** You can sell this gun only at black market !");
return 1;
}
if(PlayerInfo[playerid][pMats] > 649)
{
weapon[playerid] = 31;
price[playerid] = 650;
ammo[playerid] = 666;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"country",true) == 0)
{
if(PlayerInfo[playerid][pMats] > 449)
{
weapon[playerid] = 33;
price[playerid] = 450;
ammo[playerid] = 125;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"tec9",true) == 0)
{
if(PlayerInfo[playerid][pMats] > 199)
{
weapon[playerid] = 32;
price[playerid] = 200;
ammo[playerid] = 350;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"mac10",true) == 0)
{
if(PlayerInfo[playerid][pMats] > 199)
{
weapon[playerid] = 28;
price[playerid] = 275;
ammo[playerid] = 450;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"sniper",true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 15,1484.3933,-1731.2124,6.7213))
{
SendClientMessage(playerid, COLOR_GREY, "** You can sell this gun only at black market !");
return 1;
}
if(PlayerInfo[playerid][pMats] > 699)
{
weapon[playerid] = 34;
price[playerid] = 700;
ammo[playerid] = 150;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"molotovs",true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 15,1484.3933,-1731.2124,6.7213))
{
SendClientMessage(playerid, COLOR_GREY, "** You can sell this gun only at black market !");
return 1;
}
if(PlayerInfo[playerid][pRegularRank] == 0) return SendClientMessage(playerid, COLOR_GREY,"Only Regulars must Create this!");
if(PlayerInfo[playerid][pMats] > 799)
{
weapon[playerid] = 18;
price[playerid] = 800;
ammo[playerid] = 3;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"colt45",true) == 0)
{
if(PlayerInfo[playerid][pMats] > 124)
{
weapon[playerid] = 22;
price[playerid] = 125;
ammo[playerid] = 200;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"sawnoff",true) == 0)
{
if(PlayerInfo[playerid][pMats] > 299)
{
weapon[playerid] = 26;
price[playerid] = 300;
ammo[playerid] = 125;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"** Not enough Materials for that Weapon!");
return 1;
}
}
else if(strcmp(x_weapon,"rpg",true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 15,1484.3933,-1731.2124,6.7213))
{
SendClientMessage(playerid, COLOR_GREY, "** You can sell this gun only at black market !");
return 1;
}
if(PlayerInfo[playerid][pRegularRank] == 0) return SendClientMessage(playerid, COLOR_GREY,"Only Regulars must Create this!");
if(PlayerInfo[playerid][pMats] > 999)
{
weapon[playerid] = 35;
price[playerid] = 1000;
ammo[playerid] = 5;
}
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(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));
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);
new gunname[100];
GetWeaponName(weapon[playerid], gunname, sizeof(gunname));
format(string, sizeof(string), "* %s hands a %s to %s.", sendername, gunname,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SafeGivePlayerWeapon(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;
}