SA-MP Forums Archive
dini questions - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: dini questions (/showthread.php?tid=93312)



dini questions - ilikepie2221 - 24.08.2009

Hi there. I'm trying to check whenever a player connects, the server uses dini to check if a dini key exists for that player in a certain file. Then, it saves the value of the key to an array to avoid excessive accessing of the ini file.

pawn Код:
public OnPlayerConnect(playerid)
{
  SetPlayerMapIcon(playerid,20,337.5643,-1370.2089,14.3267,55,0); // THE ICON
  new NameString[MAX_PLAYER_NAME];
  new string[255];
  GetPlayerName(playerid,NameString,sizeof(NameString));
  string = dini_Get("LicenseInfo.ini", NameString);
  pLicensesInfo[playerid] = string; // LINE 79
  return 1;
}
Код:
C:\Users\Family\Desktop\()\SAMP server shit\filterscripts\CarSchool.pwn(79) : error 006: must be assigned to an array
Any help?


Re: dini questions - radhakr - 24.08.2009

You are trying to save a string to a variable, so it needs to be an array, for example "pLicensesInfo[MAX_PLAYERS][<maximum number of letters in string + 1>]". If it is a number that you are retrieving with dini, try "pLicensesInfo[playerid] = strval(string)".

Not sure if either will work, but you can try it.


Re: dini questions - ilikepie2221 - 24.08.2009

Eh, that didn't work.

pawn Код:
// TOP
new pLicensesInfo[playerid][256];

// CALLBACK

public OnPlayerConnect(playerid)
{
  SetPlayerMapIcon(playerid,20,337.5643,-1370.2089,14.3267,55,0); // THE ICON
  new NameString[MAX_PLAYER_NAME];
  new string[256];
  GetPlayerName(playerid,NameString,sizeof(NameString));
  string = dini_Get("LicenseInfo.ini", NameString);
  pLicensesInfo[playerid][256] = string; // LINE 80
  return 1;
}
Код:
C:\Users\Family\Desktop\()\SAMP server shit\filterscripts\CarSchool.pwn(80) : error 032: array index out of bounds (variable "pLicensesInfo")
C:\Users\Family\Desktop\()\SAMP server shit\filterscripts\CarSchool.pwn(80) : error 006: must be assigned to an array
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Any help?


Re: dini questions - CAR - 24.08.2009

I think:

pawn Код:
pLicensesInfo[playerid][256] = string[128]; // LINE 80



Re: dini questions - ilikepie2221 - 24.08.2009

Quote:
Originally Posted by CAR
I think:

pawn Код:
pLicensesInfo[playerid][256] = string[128]; // LINE 80
Just wondering, why? And I still get

Код:
C:\Users\Family\Desktop\()\SAMP server shit\filterscripts\CarSchool.pwn(80) : error 032: array index out of bounds (variable "pLicensesInfo")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: dini questions - Jefff - 24.08.2009

Top
Код:
new pLicensesInfo[MAX_PLAYERS][255];
Код:
pLicensesInfo[playerid] = string; // LINE 80



Re: dini questions - ilikepie2221 - 24.08.2009

Quote:
Originally Posted by Jefff
Top
Код:
new pLicensesInfo[MAX_PLAYERS][255];
Код:
pLicensesInfo[playerid] = string; // LINE 80
Код:
C:\Users\Family\Desktop\()\SAMP server shit\filterscripts\CarSchool.pwn(80) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Ey.



Re: dini questions - pen_theGun - 24.08.2009

public OnPlayerConnect(playerid)
{
....
new string[128];
....
}




Re: dini questions - DracoBlue - 24.08.2009

You want to set a string. This does not work with assignment, try format-function instead.

format(pLicensesInfo[playerid], sizeof(pLicensesInfo[playerid]), "%s", string);

Have fun coding,
Draco