11.04.2013, 13:44
pawn Код:
#include <a_samp>
#define TEAM_COP 0
#define TEAM_SWAT 1
#define TEAM_ARMY 2
enum
{
DIALOG_WEAPONS
}
new listitemSwitch[6][2][0] = {
{"M4A1", 31},
{"Sawnoff", 26},
{"Tec-9", 32},
{"MP5", 29},
{"Uzi", 28},
{"Sniper Rifle", 34}
};
public OnGameModeInit()
{
new i;
for(i = 0; i < MAX_PLAYERS; i++) {
SetPlayerCheckpoint(i, 2722.6714,-2385.0588,17.3403, 5.0); }
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
new stringW[256];
switch (GetPlayerTeam(playerid))
{
case TEAM_COP, TEAM_ARMY, TEAM_SWAT: {
for(new i = 0; i < sizeof(listitemSwitch); i++) {
format(stringW, sizeof(stringW), "%s\n", listitemSwitch[i][0]);
}
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", stringW, "Get weapon", "Cancel");
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPONS)
{
if(response)
{
GivePlayerWeapon(playerid, strval(listitemSwitch[listitem][1]), 1000);
}
return 1;
}
return 0;
}