warnig.. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: warnig.. (
/showthread.php?tid=507236)
warnig.. -
iBots - 16.04.2014
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?
Re: warnig.. -
Konstantinos - 16.04.2014
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]);
Re : warnig.. -
S4t3K - 16.04.2014
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(playerid, szName, sizeof(szName));
return szName;
}
In this case, you can't directly use GetName(playerid) instead of the array which contains the PlayerName