How to show Player's Team in a Dialog
#1

So I was making a /info command which tells player his information like if he has drugs, wallet etc.
I wanted to make that the /info command also shows his team name like Police Officer / Army Officer / Civillian
I can do that by SendClientMessage but how do I do it as a dialog.

This is how I did using SendClientMessage:
pawn Код:
if(gTeam[giveplayerid] == TEAM_COP) {
    SendClientMessage(playerid,-1,"{FF0000}Skill/Job: {FFFFFF}Police Officer");
    }
else
if(gTeam[giveplayerid] == TEAM_ARMY) {
    SendClientMessage(playerid,-1,"{FF0000}Skill/Job: {FFFFFF}Army");
    }
..and so on.

I want to make this show in Dialog that If he's a Police Officer, It'll show Skill/Job: Police Officer
Please do explain too as I'm new and I would like to learn it so I won't come again asking for the same.
Reply
#2

https://sampwiki.blast.hk/wiki/ShowPlayerDialog
Still confused?
https://sampforum.blast.hk/showthread.php?tid=109610

What you want:
Код:
#define DIALOG_SCLS 1001 // On top of the script

ShowPlayerDialog(playerid, DIALOG_SCLS, DIALOG_STYLE_MSGBOX, "Class help", "{FF0000}Skill/Job: {FFFFFF}Police Office", "OK", "");
Reply
#3

Alright. If i have corretly understand this looks like that, there is an exemple here. (Maybe wrong, sorry)
PHP код:
#include <zcmd>
#include <sscanf2>

CMD:info(playeridparams[])
{
    switch(
gTeam[giveplayerid])
    {
        case 
TEAM_COP:
        {
            new 
str[90];
            
format(strsizeof(str), "{FF0000}Skill/Job: {FFFFFF}Police Officer");
        }
        case 
TEAM_ARMY:
        {
            new 
str[90];
            
format(strsizeof(str), "{FF0000}Skill/Job: {FFFFFF}Army");
        }
        
ShowPlayerDialog(playerid986DIALOG_MSGBOX"Infos"str"button1""button2");
    }
    return 
1;

Reply
#4

I know this but I wanted to make something like, the dialog will show whichever team he would be in. Not only Police Officer for every team.

pawn Код:
if(gTeam[playerid] == TEAM_COP)
    {
    format(occupation, sizeof(occupation), "Police Officer");
    }
    else if(gTeam[playerid] == TEAM_ARMY)
    {
    format(occupation, sizeof(occupation),"S.A. Army Officer");
    }
    else if(gTeam[playerid] == TEAM_CIVIL)
    {
    format(occupation, sizeof(occupation),"Civillian");
    }
    else if(gTeam[playerid] == TEAM_CARFIX)
    {
    format(occupation, sizeof(occupation),"Mechanic");
    }
    else if(gTeam[playerid] == TEAM_MEDIC)
    {
    format(occupation, sizeof(occupation),"Medic");
    }
It's fixed now. This was what I wanted.
Thankyou for your reply mate!


Edit: Yes Dayrion, this was exactly what I wanted. Thank you so much mate! <3
Reply
#5

No problem and good luck!
Reply
#6

Alright, that's great! Good luck for your script!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)