SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 03/09/2014, 02:01 AM   #1
DRCharlie
Big Clucker
 
Join Date: Aug 2008
Posts: 96
Reputation: 14
Default Adding player name to .ini file

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 Code:
BaseInfo[NewID][bOwner] = GetName(playerid);

The GetName(playerid) wasn't created by me but it works with other commands.:

pawn Code:
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:

Code:
error 006: must be assigned to an array
Any help is appreciated, thank you very much in advance!
DRCharlie is offline   Reply With Quote
Old 03/09/2014, 02:05 AM   #2
IceCube!
High-roller
 
IceCube!'s Avatar
 
Join Date: Aug 2011
Location: Grove Street, Home; Atleast it was before I fucked everything up. Motto: Carpe Diem, Bitch!
Posts: 1,765
Reputation: 230
Default Re: Adding player name to .ini file

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.
__________________

Image by Phyzic
Projects (28/01/2017)
Skype: Hewlett_T
None.I'm dead, honest!
IceCube! is offline   Reply With Quote
Old 03/09/2014, 09:15 AM   #3
Marsss
Banned
 
Join Date: Dec 2013
Posts: 56
Reputation: 1
Default Re: Adding player name to .ini file

WOrked. Thnaks
Marsss is offline   Reply With Quote
Old 03/09/2014, 11:39 AM   #4
DRCharlie
Big Clucker
 
Join Date: Aug 2008
Posts: 96
Reputation: 14
Default Re: Adding player name to .ini file

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.
DRCharlie is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding new strings to an existing INI file rhds Scripting Help 5 25/03/2013 07:42 PM
Adding vehicles from file HondaCBR Scripting Help 6 09/04/2012 12:39 AM
Adding the col file to img crashes the game? telefatguy88 Scripting Help 3 27/12/2011 07:34 PM
Adding stuff to another file. Vic1990 Scripting Help 2 26/11/2011 01:22 PM
adding a new line in a file? Naxix Help Archive 13 15/04/2010 07:34 PM


All times are GMT. The time now is 03:33 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.