Errors I don't know how to fix -
Avetsky - 29.12.2015
PHP код:
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;
}
./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.
Re: Errors I don't know how to fix -
Tamy - 29.12.2015
Код:
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 ^
Re: Errors I don't know how to fix -
SecretBoss - 29.12.2015
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;
}
Re: Errors I don't know how to fix -
graef - 29.12.2015
You need to use ' \ ' at the end of line. if you want to make the string look like that.
PHP код:
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]);
Re: Errors I don't know how to fix -
J4Rr3x - 29.12.2015
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;
}
Re: Errors I don't know how to fix -
Avetsky - 29.12.2015
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(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), "{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(playerid, DIALOG_PROFILE,DIALOG_STYLE_MSGBOX,"Target Profile",string,"OK");
}
}
return 1;
}
Re: Errors I don't know how to fix -
AndySedeyn - 29.12.2015
Your string variable isn't big enough.
Re: Errors I don't know how to fix -
graef - 29.12.2015
try to raise string size to 216. or 512 or more.
after that try to calculate the real size to make your code perfect.
Re: Errors I don't know how to fix -
Avetsky - 29.12.2015
Nvm this.
Re: Errors I don't know how to fix -
Avetsky - 29.12.2015

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?