#define DIALOG_WEAPONS 91172
CMD:scs( playerid, params[])
{
format(gsString, sizeof(gsString),"Chainsaw (1 Ammo) 5 cookies\n9mm Silenced (300 Ammo) 10 Cookies\nDesert Eagle (300 Ammo) 10 Cookies\nTec9 (300 Ammo) 10 Cookies\nShotgun (300 Ammo) 10 Cookies\nMicro SMG (300 Ammo) 10 Cookies\nSawnoff Shotgun (300 Ammo) 15 Cookies\nCombat Shotgun (300 Ammo) 15 Cookies\nAK47 (300 Ammo) 15 Cookies\nM4 (300 Ammo) 15 Cookies\nFlamethrower (50 Ammo) 15 Cookies\nCountry Rifle (50 Ammo) 15 Cookies\nSniper (50 Ammo) 20 Cookies");
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "YRS Spend Cookies Dialog...",gsString , "Select", "Cancel");
return 1;
}
CMD:spendcookies( playerid, params[])
{
return cmd_scs(playerid, params);
}
if(dialogid == DIALOG_WEAPONS)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
switch(listitem)
{
case 0:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 9, 1); // Give them a desert eagle
PlayerInfo[ playerid ][ Cookies ] -= 5;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 1:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 23, 300); // Give them an AK-47
PlayerInfo[ playerid ][ Cookies ] -= 10;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 2:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 24, 300); // Give them a Combat Shotgun
PlayerInfo[ playerid ][ Cookies ] -= 10;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 3:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 32, 300); // Give them a desert eagle
PlayerInfo[ playerid ][ Cookies ] -= 10;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 4:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 25, 300); // Give them an AK-47
PlayerInfo[ playerid ][ Cookies ] -= 10;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 5:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 28, 300); // Give them a Combat Shotgun
PlayerInfo[ playerid ][ Cookies ] -= 10;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 6:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 26 , 300); // Give them a desert eagle
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 7:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 27, 300); // Give them an AK-47
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 8:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 30, 300); // Give them a Combat Shotgun
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 9:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 31, 300); // Give them a desert eagle
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 10:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 37, 50); // Give them an AK-47
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 11:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 33, 50); // Give them a Combat Shotgun
PlayerInfo[ playerid ][ Cookies ] -= 15;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
case 12:
{
for (new i = 0; i < 13; i++)
{
GivePlayerWeapon(playerid, 34, 50); // Give them a Combat Shotgun
PlayerInfo[ playerid ][ Cookies ] -= 20;
GetPlayerWeaponData(playerid, 0, PlayerInfo[ i ][ wslot ], PlayerInfo[ i ][ wslotammo ]);
}
}
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
pawn Код:
|
for (new slot = 0; slot < 13; slot++)
GetPlayerWeaponData(playerid, slot, PlayerInfo[playerid][wslot[slot]], PlayerInfo[playerid][wslotammo[slot]]);
static const
WeaponIDSlot[] = {0, 0, 1, 1, 1, 1 , 1, 1, 1, 1, 10, 10, 10, 10, 10, 10, 8, 8, 8, -1, -1, -1,
2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 4, 6, 6, 7, 7, 7, 7, 8, 12, 9, 9, 9, 11, 11, 11};
new PlayerWeapons[MAX_PLAYERS][12];
new PlayerAmmo[MAX_PLAYERS][12];
case 0:
{
GivePlayerWeapon(playerid, WEAPON_DEAGLE, 50); // Give them a desert eagle
PlayerInfo[playerid][Cookies] -= 5;
GetPlayerWeaponData(playerid, WeaponIDSlot[WEAPON_DEAGLE], PlayerWeapons[playerid][WeaponIDSlot[WEAPON_DEAGLE]], PlayerAmmo[playerid][WeaponIDSlot[WEAPON_DEAGLE]]);
}