10.10.2013, 02:30
How i can put when a player types /team a dialog pop up different team colors how i can do when they pick 1 their name turns like this [Team]eblood1 please help?
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_TEAMS:
{
new newname[MAX_PLAYER_NAME],teamname[10];
switch(listitem)
{
case 0: { format(teamname,sizeof(teamname),"Cops"); SetPlayerTeam(playerid,TEAM_COPS); }
case 1: { format(teamname,sizeof(teamname),"Grove"); SetPlayerTeam(playerid,TEAM_GROVE); }
case 2: { format(teamname,sizeof(teamname),"Vagos"); SetPlayerTeam(playerid,TEAM_VAGOS); }
}
format(newname,sizeof(newname),"[%s]%s",teamname,GetName(playerid));
SetPlayerName(playerid,newname);
}
}
return 0;
}
stock GetName(playerid)
{
new name[24];
GetPlayerName(playerid, name, sizeof(name));
strreplace(name, '_', ' ');
return name;
}
stock strreplace(string[], find, replace)
{
for(new i=0; string[i]; i++)
{
if(string[i] == find)
{
string[i] = replace;
}
}
}
#define DIALOG_TEAMS 55
#define TEAM_COPS 1
#define TEAM_GROVE 2
#define TEAM_VAGOS 3
CMD:team(playerid,params[])
{
ShowPlayerDialog(playerid,DIALOG_TEAMS,DIALOG_STYLE_LIST,"Please select a team!","Cops\nGrove\nVagos","Select","Cancel");
return 1;
}
pawn Код:
|
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_TEAMS:
{
new newname[MAX_PLAYER_NAME],teamname[10];
if(response)
{
switch(listitem)
{
case 0:
{
format(teamname,sizeof(teamname),"Cops");
SetPlayerTeam(playerid, 0);
SetPVarInt(playerid, "color", GetPlayerColor(playerid));
GivePlayerWeapon(playerid, 4, 1);
SetPlayerColor(playerid, 0xFFFF00FF); //yellow
SetPlayerPos(playerid, 734.76, -1294.02, 13.56);
SendClientMessage(playerid,COLOR_GREEN,"You have entered yellow Team use /leave to leave.");
}
case 1:
{
format(teamname,sizeof(teamname),"Grove");
SetPlayerTeam(playerid, 1);
SetPVarInt(playerid, "color", GetPlayerColor(playerid));
GivePlayerWeapon(playerid, 4, 1);
SetPlayerColor(playerid, 0x00FF00FF); //Green
SetPlayerPos(playerid, 2530.40, -1667.27, 15.16);
SendClientMessage(playerid,COLOR_GREEN,"You have entered A69 Deathmatch use /leave to leave.");
}
case 2:
{
format(teamname,sizeof(teamname),"Vagos");
SetPlayerTeam(playerid, 2);
SetPVarInt(playerid, "color", GetPlayerColor(playerid));
GivePlayerWeapon(playerid, 4, 1);
SetPlayerColor(playerid, 0x800080FF); //Purple
SetPlayerPos(playerid, 1135.93, -2037.08, 69.00);
SendClientMessage(playerid,COLOR_GREEN,"You have entered A69 Deathmatch use /leave to leave.");
}
case 3:
{
format(teamname,sizeof(teamname),"Ballas");
SetPlayerTeam(playerid, 3);
GivePlayerWeapon(playerid, 4, 1);
SetPlayerColor(playerid, 0xFF0000FF); //Red
SetPVarInt(playerid, "color", GetPlayerColor(playerid));
SendClientMessage(playerid,COLOR_GREEN,"You have entered A69 Deathmatch use /leave to leave.");
}
case 4:
{
format(teamname,sizeof(teamname),"FBI");
SetPlayerTeam(playerid, 4);
GivePlayerWeapon(playerid, 4, 1);
SetPlayerColor(playerid, 0xF6BB0FF); //Blue
SetPVarInt(playerid, "color", GetPlayerColor(playerid));
SetPlayerPos(playerid, 1761.57, -1929.92, 13.57);
SendClientMessage(playerid,COLOR_GREEN,"You have entered A69 Deathmatch use /leave to leave.");
}
}
new name[24];
GetPlayerName(playerid, name, sizeof(name));
format(newname,sizeof(newname),"[%s]%s",teamname,name);
SetPlayerName(playerid,newname);
}
}
}
return 0;
}