need help with weapon dialog
#1

Why when i pickup the case it doesnt show me the dialog.This is the code i have:

public OnGameModeInit()
{
weapon = CreatePickup(1210, 2, 2521.3564,-1681.3511,14.8824,-1);
weapon = CreatePickup(1210, 2, 1905.4609,-1352.9421,13.4692,-1);
weapon = CreatePickup(1210, 2, 2216.8201,-1171.2583,25.7266,-1);
weapon = CreatePickup(1210, 2, 2312.2629,-1203.1252,24.8876,-1);
weapon = CreatePickup(1210, 2, 2352.2600,-1507.4819,24.0000,-1);
weapon = CreatePickup(1210, 2, 2503.9373,-1758.9484,13.4601,-1);
weapon = CreatePickup(1210, 2, 1816.2310,-1556.9333,13.5052,-1);
weapon = CreatePickup(1210, 2, 1762.9436,-1906.0568,13.5670,-1);
weapon = CreatePickup(1210, 2, 1543.4761,-1619.3920,13.5546,-1);


public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == weapon)
{
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "{6EF83C}Reckless Ammunitions", "\n{F81414}Armour($3000)\nHealth($2000)\n{FFFFFF}S niper Rifle($3500)\nTec-9($3000)\nMP5($3000)\nUzi($3000)\nConbat Shotgun($2300)\nSawnoff($2200)\nShotgun($2200)\nDe sert Eagle($1900)\nSilenced 9mm($1500)\n9mm($1500)\nM4($4000)", "buy", "close");
}



if(dialogid ==DIALOG_WEAPONS)
{
if(response)
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -3000);
SetPlayerArmour(playerid, 100);
}
if(listitem == 1)
{
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -2000);
SetPlayerHealth(playerid, 100);
}
if(listitem == 2)
{
if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -4000);
GivePlayerWeapon(playerid, 34, 100);
}
if(listitem == 3)
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -3000);
GivePlayerWeapon(playerid, 32, 100);
}
if(listitem == 4)
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -3000);
GivePlayerWeapon(playerid, 29, 100);
}
if(listitem == 5)
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -3000);
GivePlayerWeapon(playerid, 28, 100);
}
if(listitem == 6)
{
if(GetPlayerMoney(playerid) < 2200) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -2200);
GivePlayerWeapon(playerid, 27, 100);
}
if(listitem == 7)
{
if(GetPlayerMoney(playerid) < 2300) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -2300);
GivePlayerWeapon(playerid, 26, 100);
}
if(listitem ==
{
if(GetPlayerMoney(playerid) < 2200) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -2200);
GivePlayerWeapon(playerid, 25, 100);
}
if(listitem == 9)
{
if(GetPlayerMoney(playerid) < 1900) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -1900);
GivePlayerWeapon(playerid, 24, 100);
}
if(listitem == 10)
{
if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -1500);
GivePlayerWeapon(playerid, 23, 100);
}
if(listitem == 11)
{
if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -1500);
GivePlayerWeapon(playerid, 22, 100);
}
if(listitem == 12)
{
if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid, 0xFF0000FF,"You do not have enough money to buy this weapon!");
GivePlayerMoney(playerid, -4000);
GivePlayerWeapon(playerid, 31, 100);
}
}
}
Reply
#2

Because all your defiens of weapon are the same for above one?

At the top of your script:
new weapon[10];

Код:
weapon[0] = CreatePickup(1210, 2, 2521.3564,-1681.3511,14.8824,-1);
weapon[1] = CreatePickup(1210, 2, 1905.4609,-1352.9421,13.4692,-1);
weapon[2] = CreatePickup(1210, 2, 2216.8201,-1171.2583,25.7266,-1);
weapon[3] = CreatePickup(1210, 2, 2312.2629,-1203.1252,24.8876,-1);
weapon[4] = CreatePickup(1210, 2, 2352.2600,-1507.4819,24.0000,-1);
weapon[5] = CreatePickup(1210, 2, 2503.9373,-1758.9484,13.4601,-1);
weapon[6] = CreatePickup(1210, 2, 1816.2310,-1556.9333,13.5052,-1);
weapon[7] = CreatePickup(1210, 2, 1762.9436,-1906.0568,13.5670,-1);
weapon[8] = CreatePickup(1210, 2, 1543.4761,-1619.3920,13.5546,-1);
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
     for(new w; w < sizeof(weapon); w++)
     {
          if(pickupid == weapon)
         {
         ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "{6EF83C}Reckless Ammunitions",          "\n{F81414}Armour($3000)\nHealth($2000)\n{FFFFFF}S niper Rifle($3500)\nTec-9($3000)\nMP5($3000)\nUzi($3000)\nConbat Shotgun($2300)\nSawnoff($2200)\nShotgun($2200)\nDe sert Eagle($1900)\nSilenced 9mm($1500)\n9mm($1500)\nM4($4000)", "buy", "close");
       }
}
NOTE: on the public OnPlayerPickupPickup use TAB to fix the spaces to avoid loose indentation.
Reply
#3

i did it but got one error

C:\Documents and Settings\NADINE.HOME-C13C86E48E\Desktop\New Folder\sampserver 2\gamemodes\lskz.pwn(288 : error 033: array must be indexed (variable "weapon")
Reply
#4

thanks guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)