SA-MP Forums Archive
Adding player name to .ini file - 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: Adding player name to .ini file (/showthread.php?tid=535311)



Adding player name to .ini file - DRCharlie - 03.09.2014

Hey guys, I haven't been scripting for a LONG LONG time and I'm really confused at the moment, I ran into some errors.

Basically I'm editing a script and I'd like to add the player's name to an .ini file.

Players can put down objects and I'd like to know who put them down by displaying it in the object's .ini file

The Code I use(everything else is written in the ini file, I'm trying to add this):

pawn Код:
BaseInfo[NewID][bOwner] = GetName(playerid);
The GetName(playerid) wasn't created by me but it works with other commands.:

pawn Код:
stock GetName(playerid)
{
    new string[128];
    GetPlayerName(playerid,string,24);
    new str[24];
    strmid(str,string,0,strlen(string),24);
    return str;
}
The error code I get when trying to compile:

Код:
error 006: must be assigned to an array
Any help is appreciated, thank you very much in advance!


Re: Adding player name to .ini file - IceCube! - 03.09.2014

In your BaseInfo array, you have defined bOwner as a variable. Define it as:

bOwner[MAX_PLAYER_NAME]

If you haven't, please post the enum here.

Also alter the size of string in your GetName Stock, it's a waste of useable memory, and servers today are very strict about memory usage per player.


Re: Adding player name to .ini file - Marsss - 03.09.2014

WOrked. Thnaks


Re: Adding player name to .ini file - DRCharlie - 03.09.2014

Yeah it worked for me too, thank you very much! Can I contact you on Skype if I have a few minor questions? I'm not making a server or anything I'm just scripting for fun.