Код:
//top of your script
Код:
#define TEAM_GUNDEL 13
//onplayercommandtext
Код:
//new giveplayerid;
if(strcmp(cmd, "/weapons", true) == 0)
{
if(gTeam[playerid] == TEAM_GUNDEL) {
SendClientMessage(playerid, COLOR_ERROR, "You are a Weapon Dealer. You have to go to ammunation buy guns");
return 1;
}
if(askedforweapons[playerid] == 1) {
SendClientMessage(playerid,COLOR_ERROR,"Command used recently... Please wait");
return 1;
}
if (!GetPlayersInTeam(TEAM_COP)) {
SendClientMessage(playerid,COLOR_ERROR,"Unable to locate any Weapon Dealers");
return 1;
}
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Dealer Called_|");
SendClientMessage(playerid,COLOR_ROYALBLUE,"You have called a Weapon Dealer to your location");
for(new i=0;i<MAX_PLAYERS;i++)
{
if(gTeam[i] == TEAM_GUNDEL)
{
//new pname[24];
new current_zone;
current_zone = player_zone[playerid];
GetPlayerName(playerid, pname, 24);
SendClientMessage(i, 0xA9A9A9AA, "|_Weapon Dealer Requested_|");
format(string1, sizeof(string1), "%s(%d) has called for a Weapon Dealer. Location: %s",pname,playerid,zones[current_zone][zone_name]);
SendClientMessage(i,COLOR_ROYALBLUE,string1);
Wantsguns[playerid] =1;
askedforweapons[playerid] =1;
}
}
return 1;
}
//onplayercommandtext
Код:
if(strcmp(cmd, "/sellweapons", true) == 0)
{
if(gTeam[playerid] != TEAM_GUNDEL) {
SendClientMessage(playerid, COLOR_ERROR, "Only Weapon Dealers can sell weapons");
return 1;
}
if(Jailed[playerid] == 1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sellweapons (id)");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sellweapons (id) ID Must be a number");
return 1;
}
if(!IsPlayerConnected(giveplayerid)) {
format(string1, sizeof(string1), "ID (%d) Is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
return 1;
}
if(Jailed[giveplayerid] == 1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot sell weapons to a prisoner");
return 1;
}
if(gTeam[giveplayerid] == TEAM_GUNDEL) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot sell weapons to another Weapon Dealer");
return 1;
}
new workername[24];
new playername[24];
GetPlayerName(playerid,workername, 24);
GetPlayerName(giveplayerid, playername, 24);
if(getdist(playerid,giveplayerid) > 15) {
format(string1, sizeof(string1), "%s(%d) Is not close enough. You cannot sell weapons to that player",playername,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
return 1;
}
if(Wantsguns[giveplayerid] == 0) {
format(string1, sizeof(string1), "%s(%d) Has not asked for a Gun Dealer. You have offered to sell Weapons",playername,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapons Offered_|");
format(string1, sizeof(string1), "%s(%d) Has offered to sell you weapons. Type /weapons to accept the offer",workername,playerid);
SendClientMessage(giveplayerid, 0x00C7FFAA, string1);
OfferedGuns[giveplayerid] =1;
return 1;
}
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapons Offered_|");
format(string1, sizeof(string1), "%s(%d) Is viewing your weapon list...Use /sellweapon %d (Item Number) to sell ... Please wait...",playername,giveplayerid,giveplayerid);
SendClientMessage(playerid, 0x00C7FFAA, string1);
format(string1, sizeof(string1), "Use /sellweapon %d (Item Number) when %s(%d) tells you the item number...",giveplayerid,playername,giveplayerid);
SendClientMessage(playerid, 0x00C7FFAA, string1);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapons Offered_|");
SendClientMessage(giveplayerid,0x00C7FFAA," Weapons available. Tell the Weapon Dealer which number you want to purchase (1-6)");
SendClientMessage(giveplayerid,0x00C7FFAA,"1. =[100 Ammo]=$2500====Silenced 9mm");
SendClientMessage(giveplayerid,0x00C7FFAA,"2. =[500 Ammo]=$1000====Tec9");
SendClientMessage(giveplayerid,0x00C7FFAA,"3. =[30 Ammo]=$3500====S/O ShotGun");
SendClientMessage(giveplayerid,0x00C7FFAA,"4. =[30 Ammo]=$15000===Sniper Rifle");
SendClientMessage(giveplayerid,0x00C7FFAA,"5. =[200 Ammo]=$8000====AK47");
SendClientMessage(giveplayerid,0x00C7FFAA,"6. ============$500=====Armor");
SendClientMessage(giveplayerid,0x00C7FFAA,"7. ============$3500=====3 Blocks Of C4");
SendClientMessage(giveplayerid,0x00C7FFAA,"8. ============$5000=====Parachute");
OfferedGuns[giveplayerid] =1;
return 1;
}
Код:
if(strcmp(cmd,"/sellweapon",true)==0)
{
if(Jailed[playerid] == 1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
return 1;
}
if(gTeam[playerid] != TEAM_GUNDEL) {
SendClientMessage(playerid, COLOR_ERROR, "Only Weapon Dealers can sell weapons");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sellweapon (id) [WEAPON.No]");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sellweapon (id) [WEAPON.No] ID Must be a number");
return 1;
}
if(Jailed[giveplayerid] == 1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot sell weapons to a prisoner");
return 1;
}
if(OfferedGuns[giveplayerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR,"No Weapon Dealer has offered to sell this player weapons. Use /sellweapons id first");
return 1;
}
new workername[24];
new playername[24];
GetPlayerName(playerid,workername, 24);
GetPlayerName(giveplayerid, playername, 24);
if(getdist(playerid,giveplayerid) > 15)
{
format(string1, sizeof(string1), "%s(%d) Is not close enough. You cannot sell weapons to that player",playername,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
return 1;
}
//if(IsPlayerConnected(playerid))
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sellweapon (id) [1-7]");
return 1;
}
if(strcmp(x_nr,"1",true) == 0)
{
if(GetPlayerMoney(giveplayerid) <= 2499) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) Has tried to sell you a Silenced 9mm weapon. You cannot afford $2500",workername,playerid);
SendClientMessage(giveplayerid, COLOR_ERROR, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) cannot afford that weapon",playername,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
return 1;
}
GivePlayerWeapon(giveplayerid,23,100);
GivePlayerMoney(giveplayerid, -2500);
GivePlayerMoney(playerid,1500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(string1, sizeof(string1), "%s(%d) Has sold you a Silenced 9mm weapon with 100 Ammo for $2500",workername,playerid);
SendClientMessage(giveplayerid, 0x00C7FFAA, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
format(string1, sizeof(string1), "%s(%d) Has purchased a Silenced 9mm weapon from you. You receive a $1500 bonus",playername,giveplayerid);
SendClientMessage(playerid, 0x00C7FFAA, string1);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
}
else if(strcmp(x_nr,"2",true) == 0)
{
if(GetPlayerMoney(giveplayerid) <= 999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) Has tried to sell you a Tec9 weapon. You cannot afford $1000",workername,playerid);
SendClientMessage(giveplayerid, COLOR_ERROR, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) cannot afford that weapon",playername,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
return 1;
}
GivePlayerWeapon(giveplayerid,32,500);
GivePlayerMoney(giveplayerid, -1000);
GivePlayerMoney(playerid,1500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(string1, sizeof(string1), "%s(%d) Has sold you a Tec9 weapon with 500 Ammo for $1000",workername,playerid);
SendClientMessage(giveplayerid, 0x00C7FFAA, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
format(string1, sizeof(string1), "%s(%d) Has purchased a Tec9 weapon from you. You receive a $1500 bonus",playername,giveplayerid);
SendClientMessage(playerid, 0x00C7FFAA, string1);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
}
else if(strcmp(x_nr,"3",true) == 0)
{
if(GetPlayerMoney(giveplayerid) <= 3499) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) Has tried to sell you a Sawnoff Shotgun weapon. You cannot afford $3500",workername,playerid);
SendClientMessage(giveplayerid, COLOR_ERROR, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) cannot afford that weapon",playername,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
return 1;
}
GivePlayerWeapon(giveplayerid,26,30);
GivePlayerMoney(giveplayerid, -3500);
GivePlayerMoney(playerid,1500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(string1, sizeof(string1), "%s(%d) Has sold you a Sawnoff Shotgun weapon with 30 Ammo for $3500",workername,playerid);
SendClientMessage(giveplayerid, 0x00C7FFAA, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
format(string1, sizeof(string1), "%s(%d) Has purchased a Sawnoff Shotgun weapon from you. You receive a $1500 bonus",playername,giveplayerid);
SendClientMessage(playerid, 0x00C7FFAA, string1);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
}
else if(strcmp(x_nr,"4",true) == 0)
{
if(GetPlayerMoney(giveplayerid) <= 14999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) Has tried to sell you a Sniper Rifle weapon. You cannot afford $15000",workername,playerid);
SendClientMessage(giveplayerid, COLOR_ERROR, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) cannot afford that weapon",playername,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
return 1;
}
GivePlayerWeapon(giveplayerid,34,30);
GivePlayerMoney(giveplayerid, -15000);
GivePlayerMoney(playerid,1500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(string1, sizeof(string1), "%s(%d) Has sold you a Sniper Rifle weapon with 30 Ammo for $15000",workername,playerid);
SendClientMessage(giveplayerid, 0x00C7FFAA, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
format(string1, sizeof(string1), "%s(%d) Has purchased a Sniper Rifle weapon from you. You receive a $1500 bonus",playername,giveplayerid);
SendClientMessage(playerid, 0x00C7FFAA, string1);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
}
else if(strcmp(x_nr,"5",true) == 0)
{
if(GetPlayerMoney(giveplayerid) <= 7999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) Has tried to sell you a AK47 weapon. You cannot afford $8000",workername,playerid);
SendClientMessage(giveplayerid, COLOR_ERROR, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) cannot afford that weapon",playername,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
return 1;
}
GivePlayerWeapon(giveplayerid,30,200);
GivePlayerMoney(giveplayerid, -8000);
GivePlayerMoney(playerid,1500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(string1, sizeof(string1), "%s(%d) Has sold you a AK47 weapon with 200 Ammo for $8000",workername,playerid);
SendClientMessage(giveplayerid, 0x00C7FFAA, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
format(string1, sizeof(string1), "%s(%d) Has purchased a AK47 weapon from you. You receive a $1500 bonus",playername,giveplayerid);
SendClientMessage(playerid, 0x00C7FFAA, string1);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
}
else if(strcmp(x_nr,"6",true) == 0)
{
if(GetPlayerMoney(giveplayerid) <= 499) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) Has tried to sell you Armor. You cannot afford $500",workername,playerid);
SendClientMessage(giveplayerid, COLOR_ERROR, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) cannot afford Armor",playername,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
return 1;
}
SetPlayerArmour(giveplayerid, 100);
GivePlayerMoney(giveplayerid, -500);
GivePlayerMoney(playerid,1500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(string1, sizeof(string1), "%s(%d) Has sold you Armor for $500",workername,playerid);
SendClientMessage(giveplayerid, 0x00C7FFAA, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
format(string1, sizeof(string1), "%s(%d) Has purchased Armor from you. You receive a $1500 bonus",playername,giveplayerid);
SendClientMessage(playerid, 0x00C7FFAA, string1);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
}
else if(strcmp(x_nr,"8",true) == 0)
{
if(GetPlayerMoney(giveplayerid) <= 4999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) Has tried to sell you a Parachute You cannot afford $5000",workername,playerid);
SendClientMessage(giveplayerid, COLOR_ERROR, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(string1, sizeof(string1), "%s(%d) cannot afford a Parachute",playername,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string1);
return 1;
}
GivePlayerWeapon(giveplayerid,46,1);
GivePlayerMoney(giveplayerid, -5000);
GivePlayerMoney(playerid,1500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(string1, sizeof(string1), "%s(%d) Has sold you a Parachute for $5000",workername,playerid);
SendClientMessage(giveplayerid, 0x00C7FFAA, string1);
SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
format(string1, sizeof(string1), "%s(%d) Has purchased a Parachute from you. You receive a $1500 bonus",playername,giveplayerid);
SendClientMessage(playerid, 0x00C7FFAA, string1);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sellweapon (id) (WEAPON.No)");
return 1;
}
return 1;
}
This is what i have but you may get a lot of errors because it's missing a lot of parts like "canchooseskill[playerid] =0;" it should be posted in different parts of your script for this to work.
But like you said, you could edit it to make it work for your script. What i gave you is basically it though