23.03.2014, 12:36
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DTEAMS)
{
if(!response) return ShowPlayerDialog(playerid, DTEAMS, DIALOG_STYLE_LIST, "Teams:", ""#EMB_USA"United States of America\n"#EMB_GERMANY"Germany", "Select", "");
if(response)
{
switch(listitem)
{
case 0:
{
new JoinMessage[128];
gTeam[playerid] = ARMY_TEAM;
SetPlayerTeam(playerid, 0);
SetPlayerPos(playerid, 203.51, 1861.86, 13.14);
SetPlayerSkin(playerid, 287);
SetPlayerColor(playerid, A_COLOR);
SendClientMessage(playerid, COLOR_USA, "[Army]: You have chosen Army Team.");
format(JoinMessage, sizeof(JoinMessage), "Player%s(%d) has joined the Army Team", GetName);
SendClientMessageToAll(COLOR_LIGHTBLUE, JoinMessage);
SpawnPlayer(playerid);
}
case 1:
{
new JoinMessage[128];
gTeam[playerid] = TERROR_TEAM;
SetPlayerPos(playerid, 268.80, 1883.47, -30.09);
SetPlayerSkin(playerid, 16);
SetPlayerColor(playerid, T_COLOR);
SetPlayerTeam(playerid, 1);
SendClientMessage(playerid, COLOR_RED, "[Terrorist]: You have chosen Terrorist Team.");
format(JoinMessage, sizeof(JoinMessage), "Player%s(%d) has joined the Terrorist Team", GetName);
SendClientMessageToAll(COLOR_LIGHTBLUE, JoinMessage);
SpawnPlayer(playerid);
}
}
}
}
return 1;
}
add this on bottom of the script
stock GetName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
return Name;
}