Adding Gender to the /stats
#1

Код:
public ShowStats(playerid,targetid)
{
	new string[250],pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid,pName,sizeof(pName));
	format(string,sizeof(string),""embed_blue"%s "embed_white"stats\n\
                    			"embed_blue"Age:"embed_white"$%s\n\
                                "embed_blue"Gender:"embed_white"%s\n\
								"embed_blue"Money:"embed_white"$%d\n\
                                "embed_blue"Kills:"embed_white"%d\n\
                                "embed_blue"Deaths:"embed_white"%d",
                                pName,
                                pInfo[playerid][Age],
                                pInfo[playerid][Gender],
                                pInfo[playerid][pMoney],
                                pInfo[playerid][Kills],
                                pInfo[playerid][Deaths]);

	ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,""embed_white"Stats",string,"Ok","");
	return 1;
}
Can someone help me add a gender system to this cause all I get from this is T or the number of the gender.
Reply
#2

pawn Код:
new stext[28];
if(pInfo[playerid][Gender] == 1) { sext = "Male"; } else { sext = "Female"; }
Then replace pInfo[playerid][Gender], on your code to

pawn Код:
sext,
Reply
#3

Is Gender 1 Male, and Gender 2 Female?
Reply
#4

Quote:
Originally Posted by Aira
Посмотреть сообщение
pawn Код:
new stext[28];
if(pInfo[playerid][Gender] == 1) { sext = "Male"; } else { sext = "Female"; }
Then replace pInfo[playerid][Gender], on your code to

pawn Код:
sext,
Код:
: error 029: invalid expression, assumed zero
: warning 217: loose indentation
: error 017: undefined symbol "sext"
: warning 215: expression has no effect
: error 001: expected token: ";", but found "]"
: fatal error 107: too many error messages on one line
pawn Код:
public ShowStats(playerid,targetid)
{
    new string[250],pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    format(string,sizeof(string),""embed_blue"%s "embed_white"stats\n\
                                "
embed_blue"Age:"embed_white"$%s\n\
                                "
embed_blue"Gender:"embed_white"%s\n\
                                "
embed_blue"Money:"embed_white"$%d\n\
                                "
embed_blue"Kills:"embed_white"%d\n\
                                "
embed_blue"Deaths:"embed_white"%d",
                                pName,
                                pInfo[playerid][Age],
                                new sext[28];
                                if(pInfo[playerid][Gender] == 1) { sext = "Male"; } else { sext = "Female"; }
                                pInfo[playerid][pMoney],
                                pInfo[playerid][Kills],
                                pInfo[playerid][Deaths]);

    ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,""embed_white"Stats",string,"Ok","");
    return 1;
}
It didn't work....


Quote:
Originally Posted by Dubya
Посмотреть сообщение
Is Gender 1 Male, and Gender 2 Female?
Yes it is. Btw guys I retired from scripting about 2009, I dabbled back in it back in 2011. The Dialog system is a bit new to me, I am sorry I am learning it as fast as I can.
Reply
#5

Guessing that Gender 1 is Male, and Gender 2 is Female, use this:
pawn Код:
public ShowStats(playerid,targetid)
{
    new string[128],pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    if(pInfo[playerid][Gender] = 1)
    {
        format(string,sizeof(string),""embed_blue"%s "embed_white"stats\n"embed_blue"Age:"embed_white"$%s\n"embed_blue"Gender:"embed_white"Male\n"embed_blue"Money:"embed_white"$%d\n\
                                    "
embed_blue"Kills:"embed_white"%d\n"embed_blue"Deaths:"embed_white"%d",pName,pInfo[playerid][Age],,pInfo[playerid][pMoney],pInfo[playerid][Kills],pInfo[playerid][Deaths]);
        ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,""embed_white"Stats",string,"Done","Exit");
    }
    else
    {
        format(string,sizeof(string),""embed_blue"%s "embed_white"stats\n"embed_blue"Age:"embed_white"$%s\n"embed_blue"Gender:"embed_white"Female\n"embed_blue"Money:"embed_white"$%d\n\
                                    "
embed_blue"Kills:"embed_white"%d\n"embed_blue"Deaths:"embed_white"%d",pName,pInfo[playerid][Age],,pInfo[playerid][pMoney],pInfo[playerid][Kills],pInfo[playerid][Deaths]);
        ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,""embed_white"Stats",string,"Done","Exit");
    }
    return 1;
}
Reply
#6

Use define's. Just make sure, you have something to load that.

pawn Код:
#define DIALOG_SEX   2
#define man 1
#define woman 0

ShowPlayerDialog(playerid,DIALOG_SEX,DIALOG_STYLE_MSGBOX,"lalaala"," - lalalal man laalaa woman?","man","woman"); // put that where you want

// that OnDialogResponse...
if(dialogid == DIALOG_SEX && response == 0)
{
   SendClientMessage(playerid,-1,"man? e.e");
   pInfo[playerid][Gender] = man;  
}
if(dialogid == DIALOG_SEX && response == 1)
{
   SendClientMessage(playerid,-1,"woman? e.e !!!!);
   pInfo[playerid][Gender] = woman;
}
Reply
#7

Quote:
Originally Posted by Dubya
Посмотреть сообщение
Guessing that Gender 1 is Male, and Gender 2 is Female, use this:
pawn Код:
public ShowStats(playerid,targetid)
{
    new string[128],pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    if(pInfo[playerid][Gender] = 1)
    {
        format(string,sizeof(string),""embed_blue"%s "embed_white"stats\n"embed_blue"Age:"embed_white"$%s\n"embed_blue"Gender:"embed_white"Male\n"embed_blue"Money:"embed_white"$%d\n\
                                    "
embed_blue"Kills:"embed_white"%d\n"embed_blue"Deaths:"embed_white"%d",pName,pInfo[playerid][Age],,pInfo[playerid][pMoney],pInfo[playerid][Kills],pInfo[playerid][Deaths]);
        ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,""embed_white"Stats",string,"Done","Exit");
    }
    else
    {
        format(string,sizeof(string),""embed_blue"%s "embed_white"stats\n"embed_blue"Age:"embed_white"$%s\n"embed_blue"Gender:"embed_white"Female\n"embed_blue"Money:"embed_white"$%d\n\
                                    "
embed_blue"Kills:"embed_white"%d\n"embed_blue"Deaths:"embed_white"%d",pName,pInfo[playerid][Age],,pInfo[playerid][pMoney],pInfo[playerid][Kills],pInfo[playerid][Deaths]);
        ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,""embed_white"Stats",string,"Done","Exit");
    }
    return 1;
}
Код:
 : warning 211: possibly unintended assignment
 : error 029: invalid expression, assumed zero
 : warning 215: expression has no effect
 : warning 215: expression has no effect
 : warning 215: expression has no effect
 : error 001: expected token: ";", but found ")"
 : error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line
It gives me those error codes.


Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
Use define's. Just make sure, you have something to load that.

pawn Код:
#define DIALOG_SEX   2
#define man 1
#define woman 0

ShowPlayerDialog(playerid,DIALOG_SEX,DIALOG_STYLE_MSGBOX,"lalaala"," - lalalal man laalaa woman?","man","woman"); // put that where you want

// that OnDialogResponse...
if(dialogid == DIALOG_SEX && response == 0)
{
   SendClientMessage(playerid,-1,"man? e.e");
   pInfo[playerid][Gender] = man;  
}
if(dialogid == DIALOG_SEX && response == 1)
{
   SendClientMessage(playerid,-1,"woman? e.e !!!!);
   pInfo[playerid][Gender] = woman;
}
I am using Defines.
Also in the players.ini/cfg, it gives the test not the number is their anyway to use that in the ShowStats code?
Reply
#8

pawn Код:
public ShowStats(playerid,targetid)
{
    new string[128],pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    if(pInfo[playerid][Gender] = 1);
    {
        format(string,sizeof(string),""embed_blue"%s "embed_white"stats\n"embed_blue"Age:"embed_white"$%s\n"embed_blue"Gender:"embed_white"Male\n"embed_blue"Money:"embed_white"$%d\n\
                                    "
embed_blue"Kills:"embed_white"%d\n"embed_blue"Deaths:"embed_white"%d",pName,pInfo[playerid][Age],,pInfo[playerid][pMoney],pInfo[playerid][Kills],pInfo[playerid][Deaths]);
        ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,""embed_white"Stats",string,"Done","Exit");
    }
    else
    {
        format(string,sizeof(string),""embed_blue"%s "embed_white"stats\n"embed_blue"Age:"embed_white"$%s\n"embed_blue"Gender:"embed_white"Female\n"embed_blue"Money:"embed_white"$%d\n\
                                    "
embed_blue"Kills:"embed_white"%d\n"embed_blue"Deaths:"embed_white"%d",pName,pInfo[playerid][Age],,pInfo[playerid][pMoney],pInfo[playerid][Kills],pInfo[playerid][Deaths]);
        ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,""embed_white"Stats",string,"Done","Exit");
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by Dubya
Посмотреть сообщение
pawn Код:
public ShowStats(playerid,targetid)
{
    new string[128],pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    if(pInfo[playerid][Gender] = 1);
    {
        format(string,sizeof(string),""embed_blue"%s "embed_white"stats\n"embed_blue"Age:"embed_white"$%s\n"embed_blue"Gender:"embed_white"Male\n"embed_blue"Money:"embed_white"$%d\n\
                                    "
embed_blue"Kills:"embed_white"%d\n"embed_blue"Deaths:"embed_white"%d",pName,pInfo[playerid][Age],,pInfo[playerid][pMoney],pInfo[playerid][Kills],pInfo[playerid][Deaths]);
        ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,""embed_white"Stats",string,"Done","Exit");
    }
    else
    {
        format(string,sizeof(string),""embed_blue"%s "embed_white"stats\n"embed_blue"Age:"embed_white"$%s\n"embed_blue"Gender:"embed_white"Female\n"embed_blue"Money:"embed_white"$%d\n\
                                    "
embed_blue"Kills:"embed_white"%d\n"embed_blue"Deaths:"embed_white"%d",pName,pInfo[playerid][Age],,pInfo[playerid][pMoney],pInfo[playerid][Kills],pInfo[playerid][Deaths]);
        ShowPlayerDialog(playerid,1234,DIALOG_STYLE_MSGBOX,""embed_white"Stats",string,"Done","Exit");
    }
    return 1;
}
Still gave me errors.
Reply
#10

pawn Код:
new sext[28];
if(pInfo[playerid][Gender] == 1) { sext = "Male"; } else { sext = "Female"; }
Then replace pInfo[playerid][Gender], on your code to

pawn Код:
sext,
Misstyped stext instead of sext
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)