Tag mismatch -
Face9000 - 20.05.2012
Hello,i was coding this /info command for admins and i stucked at this problem.
P.S I used strcat because the single dialog line was too long.
Errors:
(3605) : error 035: argument type mismatch (argument 3)
(3611) : warning 213: tag mismatch
(3612) : warning 213: tag mismatch
Line 3605:
pawn Код:
strcat(info,"Name: %s\n",name);
Line 3611:
pawn Код:
strcat(info,"Health: %0.1f\n", gihp);
Line 3612:
pawn Код:
strcat(info,"Armour: %0.1f\n", giar);
This are the floats for armour and health.And the check of the player name:
pawn Код:
new Float:gihp, Float:giar;
new name[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, name, sizeof(name));
GetPlayerHealth(giveplayerid, gihp);
GetPlayerArmour(giveplayerid, giar);
What's wrong on this?
Re: Tag mismatch -
ReneG - 20.05.2012
That's not how strcat is used. Click
me.
strcat only concatenates strings (puts them together), it doesn't format them. Format the strings then put them together with strcat.
Re: Tag mismatch -
Face9000 - 20.05.2012
Can you give me an example?
This is the whole /info command.
pawn Код:
CMD:info(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new giveplayerid;
new Float:gihp, Float:giar;
new name[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, name, sizeof(name));
GetPlayerHealth(giveplayerid, gihp);
GetPlayerArmour(giveplayerid, giar);
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /info [ID/PartOfName]");
if(IsPlayerConnected(giveplayerid))
{
new info[2056];
strcat(info,"{0FA0D1}Name: %s\n",name);
strcat(info,"{0FA0D1}Cash: %i$\n",GetPlayerMoney(playerid));
strcat(info,"{0FA0D1}Wanted Level: %d\n",PlayerInfo[playerid][pWantedLevel]);
strcat(info,"{0FA0D1}Admin Level: %s\n",PlayerInfo[playerid][pAdmin]);
strcat(info,"{0FA0D1}Kills: %i\n",PlayerInfo[playerid][pKills]);
strcat(info,"{0FA0D1}Deaths: %i\n",PlayerInfo[playerid][pDeaths]);
strcat(info,"{0FA0D1}Health: %0.1f\n", gihp);
strcat(info,"{0FA0D1}Armour: %0.1f\n", giar);
strcat(info,"{0FA0D1}VIP: %d (1 = YES - 0 = NO)\n",PlayerInfo[playerid][pVip]);
strcat(info,"{0FA0D1}Score: %i\n",GetPlayerScore(playerid));
strcat(info,"{0FA0D1}Condoms %d\n",PlayerInfo[playerid][pCondoms]);
strcat(info,"{0FA0D1}Life Insurance %d\n",PlayerInfo[playerid][pLifeIns]);
ShowPlayerDialog(playerid, 17, DIALOG_STYLE_MSGBOX,"{53C506}Player Info",info,"Close","");
}
else
{
SendClientMessage(playerid, red, "Invalid player specified.");
}
return true;
}
else return 0;
}
Re: Tag mismatch -
Vince - 20.05.2012
pawn Код:
new temp[64];
format(temp, sizeof(temp), "{0FA0D1}Name: %s\n",name);
strcat(info, temp);
format(temp, sizeof(temp), "{0FA0D1}Cash: %i$\n",GetPlayerMoney(playerid));
strcat(info, temp);
// etc, etc, etc
Re: Tag mismatch -
Face9000 - 21.05.2012
Ah,got it,thanks.