04.02.2013, 09:51
* sorry for my bad english ..
this is my fs ..
why the dialogs no response
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define Red 0xFF0000AA
#define Yellow 0xF6FF00AA
#define Aqua 0x00FFFFFF
#define red "{FF0000}"
#define blue "{0059FF}"
#define DIALOG_TDM (4856)
#define DIALOG_TDM1 (4846)
#define TeamBlue (0)
#define TeamRed (1)
// V Credit to snir_sofer V
new name1[MAX_PLAYERS][MAX_PLAYER_NAME];
#define GetName(%0) name1[%0]
#define UpdateName(%0) GetPlayerName(%0, name1[%0], sizeof name1[])
public OnPlayerConnect(playerid) return UpdateName(playerid);
// ^ Credit to snir_sofer ^
forward TDMClose();
enum Enum
{
bool:Active,
BluePlayers,
RedPlayers,
BlueKills,
RedKills,
Prize,
Time
}
new TDM[Enum], bool:BlueTeam[MAX_PLAYERS char], bool:RedTeam[MAX_PLAYERS char], Guns[MAX_PLAYERS char];
new Float:BluePos[3][4] =
{
{},
{},
{}
};
new Float:RedPos[3][4] =
{
{},
{},
{}
};
public OnFilterScriptInit()
{
// EnableVehicleFriendlyFire(); // if you use 0.3x ..
return true;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
switch(dialogid)
{
case DIALOG_TDM:
{
switch(listitem)
{
case 0:
{
ResetPlayerWeapons(playerid);
BlueTeam{playerid} = true;
TDM[BluePlayers]++;
SetPlayerTeam(playerid, TeamBlue);
new rand = random(sizeof BluePos);
SetPlayerPos(playerid, BluePos[rand][0], BluePos[rand][1], BluePos[rand][2]);
SetPlayerFacingAngle(playerid, BluePos[rand][3]);
ShowPlayerDialog(playerid, DIALOG_TDM1, DIALOG_STYLE_LIST, "Team Death Match [TDM] - "blue"Blue Team", ""blue"Uzi, Tec-9, MP5 and 9mm\nM4, Combat Shotgun, AK-47 and Silenced 9mm\nSniper, Desert Eagle and Grenade", "Ok", "Cancel");
}
case 1:
{
ResetPlayerWeapons(playerid);
RedTeam{playerid} = true;
TDM[RedPlayers]++;
SetPlayerTeam(playerid, TeamRed);
new rand = random(sizeof RedPos);
SetPlayerPos(playerid, RedPos[rand][0], RedPos[rand][1], RedPos[rand][2]);
SetPlayerFacingAngle(playerid, RedPos[rand][3]);
ShowPlayerDialog(playerid, DIALOG_TDM1, DIALOG_STYLE_LIST, "Team Death Match [TDM] - "red"Red Team", ""red"Uzi, Tec-9, MP5 and 9mm\nM4, Combat Shotgun, AK-47 and Silenced 9mm\nSniper, Desert Eagle and Grenade", "Ok", "Cancel");
}
}
return true;
}
case DIALOG_TDM1:
{
switch(listitem)
{
case 0:
{
Guns{playerid} = 0;
GivePlayerWeapon(playerid, 28, 900);
GivePlayerWeapon(playerid, 32, 900);
GivePlayerWeapon(playerid, 29, 900);
GivePlayerWeapon(playerid, 22, 900);
}
case 1:
{
Guns{playerid} = 1;
GivePlayerWeapon(playerid, 31, 900);
GivePlayerWeapon(playerid, 27, 900);
GivePlayerWeapon(playerid, 30, 900);
GivePlayerWeapon(playerid, 23, 900);
}
case 2:
{
Guns{playerid} = 2;
GivePlayerWeapon(playerid, 34, 900);
GivePlayerWeapon(playerid, 24, 900);
GivePlayerWeapon(playerid, 16, 900);
}
}
return true;
}
}
}
return true;
}
public OnPlayerDisconnect(playerid, reason)
{
if(BlueTeam{playerid}) TDM[BluePlayers]--;
if(RedTeam{playerid}) TDM[RedPlayers]--;
return true;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(BlueTeam{killerid}) TDM[BlueKills]++;
if(RedTeam{killerid}) TDM[RedKills]++;
return true;
}
public OnPlayerSpawn(playerid)
{
if(BlueTeam{playerid})
{
ResetPlayerWeapons(playerid);
SetPlayerTeam(playerid, TeamBlue);
new rand = random(sizeof BluePos);
SetPlayerPos(playerid, BluePos[rand][0], BluePos[rand][1], BluePos[rand][2]);
SetPlayerFacingAngle(playerid, BluePos[rand][3]);
switch(Guns{playerid})
{
case 0:
{
GivePlayerWeapon(playerid, 28, 900);
GivePlayerWeapon(playerid, 32, 900);
GivePlayerWeapon(playerid, 29, 900);
GivePlayerWeapon(playerid, 22, 900);
}
case 1:
{
GivePlayerWeapon(playerid, 31, 900);
GivePlayerWeapon(playerid, 27, 900);
GivePlayerWeapon(playerid, 30, 900);
GivePlayerWeapon(playerid, 23, 900);
}
case 2:
{
GivePlayerWeapon(playerid, 34, 900);
GivePlayerWeapon(playerid, 24, 900);
GivePlayerWeapon(playerid, 16, 900);
}
}
}
if(RedTeam{playerid})
{
ResetPlayerWeapons(playerid);
SetPlayerTeam(playerid, TeamRed);
new rand = random(sizeof RedPos);
SetPlayerPos(playerid, RedPos[rand][0], RedPos[rand][1], RedPos[rand][2]);
SetPlayerFacingAngle(playerid, RedPos[rand][3]);
switch(Guns{playerid})
{
case 0:
{
GivePlayerWeapon(playerid, 28, 900);
GivePlayerWeapon(playerid, 32, 900);
GivePlayerWeapon(playerid, 29, 900);
GivePlayerWeapon(playerid, 22, 900);
}
case 1:
{
GivePlayerWeapon(playerid, 31, 900);
GivePlayerWeapon(playerid, 27, 900);
GivePlayerWeapon(playerid, 30, 900);
GivePlayerWeapon(playerid, 23, 900);
}
case 2:
{
GivePlayerWeapon(playerid, 34, 900);
GivePlayerWeapon(playerid, 24, 900);
GivePlayerWeapon(playerid, 16, 900);
}
}
}
return true;
}
public TDMClose()
{
if(TDM[Active])
{
TDM[Active] = false;
TDM[BluePlayers] = 0;
TDM[RedPlayers] = 0;
TDM[BlueKills] = 0;
TDM[RedKills] = 0;
TDM[Prize] = 0;
TDM[Time] = 0;
for(new i = 0; i < GetMaxPlayers(); i++) if(BlueTeam{i} || RedTeam{i})
{
BlueTeam{i} = false;
RedTeam{i} = false;
SpawnPlayer(i);
SetPlayerTeam(i, NO_TEAM);
}
SendClientMessageToAll(Yellow, "The Team Death Match closed by the system.");
}
return true;
}
CMD:tdmopen(playerid, params[])
{
new string[120];
if(!IsPlayerAdmin(playerid)) return false;
if(TDM[Active]) return SendClientMessage(playerid, Red, "The TDM is open, to close type: /TDMClose");
if(sscanf(params, "ii", TDM[Prize], TDM[Time])) return SendClientMessage(playerid, Red, "/TDMOpen [Prize] [Time (Seconds)]");
TDM[Active] = true;
SetTimer("TDMClose", 1000*TDM[Time], false);
format(string, sizeof string, "The admin %s opened the Team Death Match for %d seconds [prize for winners: %d$] !", GetName(playerid), TDM[Time], TDM[Prize]);
SendClientMessageToAll(Aqua, string);
return true;
}
CMD:tdmclose(playerid, params[])
{
new string[MAX_PLAYER_NAME+41];
if(!IsPlayerAdmin(playerid)) return false;
if(!TDM[Active]) return SendClientMessage(playerid, Red, "The TDM is close, to open type: /TDMOpen");
TDM[Active] = false;
TDM[BluePlayers] = 0;
TDM[RedPlayers] = 0;
TDM[BlueKills] = 0;
TDM[RedKills] = 0;
TDM[Prize] = 0;
TDM[Time] = 0;
for(new i = 0; i < GetMaxPlayers(); i++) if(BlueTeam{i} || RedTeam{i})
{
BlueTeam{i} = false;
RedTeam{i} = false;
SpawnPlayer(i);
SetPlayerTeam(i, NO_TEAM);
}
format(string, sizeof string, "The admin %s closed the Team Death Match.", GetName(playerid));
SendClientMessageToAll(Yellow, string);
return true;
}
//TDMOut
//ChangeGuns
//ChangeTeam
CMD:tdm(playerid, params[])
{
if(!TDM[Active]) return SendClientMessage(playerid, Red, "The TDM is close.");
if(BlueTeam[playerid] || RedTeam[playerid])
{
BlueTeam{playerid} = false;
RedTeam{playerid} = false;
SpawnPlayer(playerid);
SetPlayerTeam(playerid, NO_TEAM);
return 1;
}
ShowPlayerDialog(playerid, DIALOG_TDM, DIALOG_STYLE_LIST, "Team Death Match [TDM]", ""blue"Blue Team\n"red"Red Team", "Next", "Cancel");
return true;
}
why the dialogs no response