warnig..
#1

i am making formats....like string and...but when i put GetPlayerName(playerid) at the format to put the name istead of %s it shows warning,why?
pawn Код:
format(string, sizeof(string), "%s has attempted to take control of the %s for %s, 10 minutes left.", GetPlayerName(playerid),PointInfo[PointCapturable][PointName],FamilyInfo[PlayerInfo[playerid][pFMember]][FamilyName]);
why?
Reply
#2

GetPlayerName does not return the name directly but it stores it to an array by reference:
pawn Код:
new pname[21];
GetPlayerName(playerid, pname, sizeof (pname));
format(string, sizeof(string), "%s has attempted to take control of the %s for %s, 10 minutes left.", pname,PointInfo[PointCapturable][PointName],FamilyInfo[PlayerInfo[playerid][pFMember]][FamilyName]);
Reply
#3

If you don't want to have to use references, simply use GetName(playerid)

PHP код:
stock GetName(playerid)
{
   new 
szName[MAX_PLAYER_NAME+1];
   
GetPlayerName(playeridszNamesizeof(szName));
   return 
szName;

In this case, you can't directly use GetName(playerid) instead of the array which contains the PlayerName
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)