22.06.2013, 15:19
Okay, so i've create a team deathmatch gamemode, and i create a dialog for buying a weapon.
this is the code
and my SHOP_DIALOG
and when i go to ammunation and use /buygun its look like this
this is the code
pawn Код:
new LongDialog[2048];
if (strcmp("/buygun", cmdtext, true, 24) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, 286.148986,-40.644397,1001.515625))
{
strcat(LongDialog,"Golf Club - 1 Ammo - $500");
strcat(LongDialog,"Katana - 1 Ammo - $1000");
strcat(LongDialog,"Grenade - 10 Ammo - $80000");
strcat(LongDialog,"Molotov - 10 Ammo - $50000");
strcat(LongDialog,"Glock - 250 Ammo - $2500");
strcat(LongDialog,"Silenced Pistol - 250 Ammo - $2500");
strcat(LongDialog,"Desert Eagle - 75 Ammo - $15000");
strcat(LongDialog,"Shotgun - 200 Ammo - $5000");
strcat(LongDialog,"Combat Shotgun - 125 Ammo - $10000");
strcat(LongDialog,"Sawn off Shotgun - 75 Ammo - $25000");
strcat(LongDialog,"Uzi - 500 Ammo - $20000");
strcat(LongDialog,"MP5 - 500 Ammo - $25000");
strcat(LongDialog,"AK47 - 150 Ammo - $5000");
strcat(LongDialog,"M4 - 150 Ammo - $5000");
strcat(LongDialog,"Tec-9 - 750 Ammo - $25000");
strcat(LongDialog,"Country Rifle - 200 Ammo - $6500");
strcat(LongDialog,"Sniper Rifle - 100 Ammo - $15000");
strcat(LongDialog,"Fire Extinguisher - 500 Ammo - $10000");
strcat(LongDialog,"Parachute - 1 Ammo - $1500");
strcat(LongDialog,"Camera - 500 Ammo - $1500");
strcat(LongDialog,"Armour & Health - $7500");
ShowPlayerDialog(playerid, SHOP_DIALOG, DIALOG_STYLE_LIST, "Weapon Shop",LongDialog, "Select", "Exit");
return 1;
}
else//Else there NOT within the coordinates set for the Weapon Shop.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: Your not at a Weapon Shop STUPID!");//Tell them.
}
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == SHOP_DIALOG)
{
if(dialogid == SHOP_DIALOG)//If the dialog responded to is our Weapon Shop dialog.
{
if(!response) return SendClientMessage(playerid, -1, "[PETER GRIFFIN]: You have left the Weapon Shop.");//If they click "Exit" they have left the dialog(Shop).
switch(listitem)
{
case 0://Golf club
{
if(GetPlayerMoney(playerid) >= 500)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -500);//Take the cost.
GivePlayerWeapon(playerid, 2, 1);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Golf club Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 1://Katana
{
if(GetPlayerMoney(playerid) >= 1000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -1000);//Take the cost.
GivePlayerWeapon(playerid, 8, 1);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Katana Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 2://Grenade
{
if(GetPlayerMoney(playerid) >= 80000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -80000);//Take the cost.
GivePlayerWeapon(playerid, 16, 10);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Grenade Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 3://Molotov
{
if(GetPlayerMoney(playerid) >= 50000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -50000);//Take the cost.
GivePlayerWeapon(playerid, 18, 10);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Molotov Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 4://Glock
{
if(GetPlayerMoney(playerid) >= 2500)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -2500);//Take the cost.
GivePlayerWeapon(playerid, 22, 250);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Glock Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 5://Silenced
{
if(GetPlayerMoney(playerid) >= 2500)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -2500);//Take the cost.
GivePlayerWeapon(playerid, 23, 250);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Silenced Pistol Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 6://Desert Eagle
{
if(GetPlayerMoney(playerid) >= 15000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -15000);//Take the cost.
GivePlayerWeapon(playerid, 24, 75);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Desert Eagle Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 7://Shotgun
{
if(GetPlayerMoney(playerid) >= 5000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -5000);//Take the cost.
GivePlayerWeapon(playerid, 25, 200);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Shotgun Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 8://Combat Shotgun
{
if(GetPlayerMoney(playerid) >= 10000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -10000);//Take the cost.
GivePlayerWeapon(playerid, 27, 125);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Combat Shotgun Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 9://Sawn-off
{
if(GetPlayerMoney(playerid) >= 25000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -50000);//Take the cost.
GivePlayerWeapon(playerid, 26, 75);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Sawn - off Shotgun Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 10://Uzi
{
if(GetPlayerMoney(playerid) >= 20000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -20000);//Take the cost.
GivePlayerWeapon(playerid, 28, 500);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Uzi Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 11://MP5
{
if(GetPlayerMoney(playerid) >= 25000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -25000);//Take the cost.
GivePlayerWeapon(playerid, 29, 500);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: MP5 purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 12://AK47
{
if(GetPlayerMoney(playerid) >= 5000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -5000);//Take the cost.
GivePlayerWeapon(playerid, 30, 150);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: AK47 Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 13://M4
{
if(GetPlayerMoney(playerid) >= 5000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -5000);//Take the cost.
GivePlayerWeapon(playerid, 31, 150);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: M4A1 Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 14://Tec-9
{
if(GetPlayerMoney(playerid) >= 25000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -25000);//Take the cost.
GivePlayerWeapon(playerid, 32, 750);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: TEC-9 Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 15://Rifle
{
if(GetPlayerMoney(playerid) >= 6500)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -6500);//Take the cost.
GivePlayerWeapon(playerid, 33, 200);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Country Rifle Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 16://Sniper Rifle
{
if(GetPlayerMoney(playerid) >= 15000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -15000);//Take the cost.
GivePlayerWeapon(playerid, 34, 100);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Sniper Rifle Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 17://Fire Extinguisher
{
if(GetPlayerMoney(playerid) >= 10000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -10000);//Take the cost.
GivePlayerWeapon(playerid, 42, 500);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Fire Extinguisher Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 18://Parachute
{
if(GetPlayerMoney(playerid) >= 1500)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -1500);//Take the cost.
GivePlayerWeapon(playerid, 46, 1);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Parachute Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 19://Camera
{
if(GetPlayerMoney(playerid) >= 1500)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -1500);//Take the cost.
GivePlayerWeapon(playerid, 43, 500);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Camera Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 20://Armour & Health
{
if(GetPlayerMoney(playerid) >= 7500)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, -7500);//Take the cost.
SetPlayerArmour(playerid, 100.0);
SetPlayerHealth(playerid, 100.0);
SendClientMessage(playerid, -1, "[PETER GRIFFIN]: Armour & Health Purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "[PETER GRIFFIN]: You dont have the enough money to purchase this weapon, Get a Job Assholes!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
}
}
return 1;
}
return 1;
}