SA-MP Forums Archive
Writing a string to playerfiles - 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: Writing a string to playerfiles (/showthread.php?tid=471679)



Writing a string to playerfiles - Jacksta21 - 24.10.2013

I'm trying to write a string to someones player file, when they are banned.
What I'm trying to do;
Код:
PlayerInfo[playerid][pBanReason] = reason;
PlayerInfo[playerid][pBannedBy] = GetPlayerNameEx(giveplayerid);
I've tried things like
strcpy(PlayerInfo[playerid][pBanReason], reason, sizeof(reason));
that just gives an error... I'm not sure how to go about doing this?


Re: Writing a string to playerfiles - reckst4r - 24.10.2013

Sorry, I misread your issue.


Re: Writing a string to playerfiles - xVIP3Rx - 24.10.2013

Maybe this ?
pawn Код:
format(PlayerInfo[playerid][pBanReason], sizeof(PlayerInfo[playerid][pBanReason]), "%s", reason);



Re: Writing a string to playerfiles - Jacksta21 - 24.10.2013

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
Maybe this ?
pawn Код:
format(PlayerInfo[playerid][pBanReason], sizeof(PlayerInfo[playerid][pBanReason]), "%s", reason);
That gives me errors.
I got
strcpy(PlayerInfo[playerid][pBannedBy], GetPlayerNameEx(playerid), MAX_PLAYER_NAME);
That works without error, it's just the ban reason I can't seem to get to work. I'll look into that tutorial...