#1

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?
Reply
#2

wiki.sa-mp.com/wiki/ShowPlayerDialog
Reply
#3

Quote:
Originally Posted by Mattakil
Посмотреть сообщение
wiki.sa-mp.com/wiki/ShowPlayerDialog
Not the Dialog
Reply
#4

Do you mean their player name turns red when selected? Kind of like a target?
Reply
#5

Quote:
Originally Posted by Mattakil
Посмотреть сообщение
Do you mean their player name turns red when selected? Kind of like a target?
Nope when they do /team and click on the Yellow team their name change to [team]eblood1 till they leave the team
Reply
#6

pawn Код:
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;
}
Reply
#7

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
pawn Код:
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;
}
how i can add all that in there?

switch(dialogid)
{
case 54:
{
if(response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerTeam(playerid) == 0)
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,GREEN,"You have entered yellow Team use /leave to leave.");
}
case 1:
{
if(GetPlayerTeam(playerid) == 0)
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,GREEN,"You have entered A69 Deathmatch use /leave to leave.");
}
case 2:
{
if(GetPlayerTeam(playerid) == 0)
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,GREEN,"You have entered A69 Deathmatch use /leave to leave.");
}
case 3:
{
if(GetPlayerTeam(playerid) == 0)
SetPlayerTeam(playerid, 3);
SetPVarInt(playerid, "color", GetPlayerColor(playerid));
GivePlayerWeapon(playerid, 4, 1);
SetPlayerColor(playerid, 0xFF0000FF); //Red
SendClientMessage(playerid,GREEN,"You have entered A69 Deathmatch use /leave to leave.");
}
case 4:
{
if(GetPlayerTeam(playerid) == 0)
SetPlayerTeam(playerid, 4);
SetPVarInt(playerid, "color", GetPlayerColor(playerid));
GivePlayerWeapon(playerid, 4, 1);
SetPlayerColor(playerid, 0xF6BB0FF); //Blue
SetPlayerPos(playerid, 1761.57, -1929.92, 13.57);
SendClientMessage(playerid,GREEN,"You have entered A69 Deathmatch use /leave to leave.");
}
}
}
}
}
Reply
#8

Edit the post and put [.pawn] before the code and [./pawn] at the end of the code please.
With the full stops ".".

EDIT: Sorry, missed the full stops at first but it's okay. 1 second.
Reply
#9

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
Edit the post and put
pawn Код:
before the code and
at the end of the code please.
i dont know how to put it like that :/
Reply
#10

Ok here, it works and all. I tested it.

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)