Errors I don't know how to fix
#1

PHP код:
CMD:profile(playeridparams[])
{
    if(
IsAHitman(playerid))
    {
        new 
string[128], giveplayerid;
        if(
sscanf(params"u"giveplayerid)) return SendClientMessageEx(playeridCOLOR_GREY"USAGE: /profile [player]");
        if(
IsPlayerConnected(giveplayerid))
        {
            
format(stringsizeof(string), "Name: %s\n
            Date of Birth: %s\n
            Phone Number: %s\n
            Bounty: %s\n
            Bounty Reason: %s\n"
,
            
GetPlayerNameEx(giveplayerid), 
            
PlayerInfo[giveplayerid][pBirthDate], 
            
PlayerInfo[giveplayerid][pPnumber], 
            
PlayerInfo[giveplayerid][pHeadValue]),
            
PlayerInfo[giveplayerid][pContractDetail]);
            
ShowPlayerDialog(playeridDIALOG_PROFILE,DIALOG_STYLE_MSGBOX,"Target Profile",string,"OK");
        }
    }
    return 
1;

./includes/commands.pwn(55789) : error 037: invalid string (possibly non-terminated string)
./includes/commands.pwn(55789) : error 029: invalid expression, assumed zero
./includes/commands.pwn(55789) : error 017: undefined symbol "s"
./includes/commands.pwn(55789) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.


The line
Код:
			format(string, sizeof(string), "Name: %s\n
is 55789.
Reply
#2

Код:
format(string, sizeof(string), "Name: %s\n  Date of Birth: %s\n Phone Number: %s\n Bounty: %s\n Bounty Reason: %s\n", 
GetPlayerNameEx(giveplayerid),  PlayerInfo[giveplayerid][pBirthDate],  PlayerInfo[giveplayerid][pPnumber],  PlayerInfo[giveplayerid][pHeadValue]), PlayerInfo[giveplayerid][pContractDetail]); ShowPlayerDialog(playerid, DIALOG_PROFILE,DIALOG_STYLE_MSGBOX,"Target Profile",string,"OK");
Keep this in one line like ^
Reply
#3

Try this, you had a ')' more, so you ended the format before it's needed

Код:
CMD:profile(playerid, params[])
{
    if(IsAHitman(playerid))
    {
        new string[128], giveplayerid;
        if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /profile [player]");

        if(IsPlayerConnected(giveplayerid))
        {
            format(string, sizeof(string), "Name: %s\n Date of Birth: %s\nPhone Number: %s\nBounty: %s\nBounty Reason: %s\n",GetPlayerNameEx(giveplayerid), PlayerInfo[giveplayerid][pBirthDate], PlayerInfo[giveplayerid][pPnumber], PlayerInfo[giveplayerid][pHeadValue], PlayerInfo[giveplayerid][pContractDetail]);
            ShowPlayerDialog(playerid, DIALOG_PROFILE,DIALOG_STYLE_MSGBOX,"Target Profile",string,"OK");
        }
    }
    return 1;
}
Reply
#4

You need to use ' \ ' at the end of line. if you want to make the string look like that.
PHP код:
           format(stringsizeof(string), "Name: %s\n  \
            Date of Birth: %s\n  \
            Phone Number: %s\n \
            Bounty: %s\n \
            Bounty Reason: %s\n"
,  
            
GetPlayerNameEx(giveplayerid),
            
PlayerInfo[giveplayerid][pBirthDate],
            
PlayerInfo[giveplayerid][pPnumber],
            
PlayerInfo[giveplayerid][pHeadValue]),
            
PlayerInfo[giveplayerid][pContractDetail]); 
Reply
#5

You have a bracket after PlayerInfo[giveplayerid][pHeadValue] and you need to put a \ at the end of the line.

This is correct:
pawn Код:
CMD:profile(playerid, params[])
{
    if(IsAHitman(playerid))
    {
        new string[128], giveplayerid;
        if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /profile [player]");

        if(IsPlayerConnected(giveplayerid))
        {
            format(string, sizeof(string), "Name: %s\n \
            Date of Birth: %s\n \
            Phone Number: %s\n \
            Bounty: %s\n \
            Bounty Reason: %s\n"
,
            GetPlayerNameEx(giveplayerid),
            PlayerInfo[giveplayerid][pBirthDate],
            PlayerInfo[giveplayerid][pPnumber],
            PlayerInfo[giveplayerid][pHeadValue],
            PlayerInfo[giveplayerid][pContractDetail]);
            ShowPlayerDialog(playerid, DIALOG_PROFILE,DIALOG_STYLE_MSGBOX,"Target Profile",string,"OK");
        }
    }
    return 1;
}
Reply
#6

This is what it shows in-game, I added color formats into the code, what might be wrong with it then?



Current code:
PHP код:
CMD:profile(playeridparams[])
{
    if(
IsAHitman(playerid))
    {
        new 
string[128], giveplayerid;
        if(
sscanf(params"u"giveplayerid)) return SendClientMessageEx(playeridCOLOR_GREY"USAGE: /profile [player]");

        if(
IsPlayerConnected(giveplayerid))
        {
            
format(stringsizeof(string), "{ff7575}Name: {ffffff}%s\n{ff7575}Date of Birth: {ffffff}%s\n{ff7575}Phone Number: {ffffff}%s\n\n{ff7575}Bounty: {ffffff}%s\n{ff7575}Bounty Reason: {ffffff}%s\n",GetPlayerNameEx(giveplayerid), PlayerInfo[giveplayerid][pBirthDate], PlayerInfo[giveplayerid][pPnumber], PlayerInfo[giveplayerid][pHeadValue], PlayerInfo[giveplayerid][pContractDetail]);
            
ShowPlayerDialog(playeridDIALOG_PROFILE,DIALOG_STYLE_MSGBOX,"Target Profile",string,"OK");
        }
    }
    return 
1;

Reply
#7

Your string variable isn't big enough.
Reply
#8

try to raise string size to 216. or 512 or more.

after that try to calculate the real size to make your code perfect.
Reply
#9

Nvm this.
Reply
#10


Changed the string variable to 512 and now it looks like this, why is the phone number showing as weird symbols by the way? What is causing it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)