SA-MP Forums Archive
Getting a string with dini? - 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: Getting a string with dini? (/showthread.php?tid=152876)



Getting a string with dini? - jameskmonger - 06.06.2010

I found out how to set a string (dini_Set) but how can I recieve a string from a file?
Код:
PlayerInfo[playerid][Nick] = dini_Get(file, "Nick");
gives me this error:
Quote:

C:\Users\James\Desktop\SAMP\gamemodes\dm.pwn(243) : error 006: must be assigned to an array

PlayerInfo[playerid][Nick] = dini_Str(file, "Nick"); gives me this error:
Quote:

C:\Users\James\Desktop\SAMP\gamemodes\dm.pwn(243) : error 017: undefined symbol "dini_Str"




Re: Getting a string with dini? - DJDhan - 06.06.2010

In your PlayerInfo enum, you should declare Nick as "Nick[256]".
And there no function like "dini_str".


Re: Getting a string with dini? - jameskmonger - 06.06.2010

Quote:

C:\Users\James\Desktop\SAMP\gamemodes\dm.pwn(243) : error 047: array sizes do not match, or destination array is too small




Re: Getting a string with dini? - Nero_3D - 06.06.2010

it would be MAX_STRING (255) but there is no reason to make it so big

pawn Код:
strmid(PlayerInfo[playerid][Nick], dini_Get(file, "Nick"), 0, MAX_PLAYER_NAME);



Re: Getting a string with dini? - jameskmonger - 06.06.2010

Now I've got this:
Код:
	if(strcmp(cmd, "/stats", true) == 0)
	{
  	    new string[128];
	 	format(string, sizeof(string), "Stats of %s (%s)", GetPlayerName(playerid), PlayerInfo[playerid][Nick]);
		SendClientMessage(playerid, COLOR_WHITE, string);
	}
And I get these:
Quote:

C:\Users\James\Desktop\SAMP\gamemodes\dm.pwn(259) : warning 202: number of arguments does not match definition
C:\Users\James\Desktop\SAMP\gamemodes\dm.pwn(259) : warning 202: number of arguments does not match definition




Re: Getting a string with dini? - Naxix - 06.06.2010

Код:
	if(strcmp(cmd, "/stats", true) == 0)
	{
  	    new string[128],name[MAX_PLAYER_NAME];
        GetPlayerName(playerid,name,sizeof(name));
	 	format(string, sizeof(string), "Stats of %s (%s)", name, PlayerInfo[playerid][Nick]);
		SendClientMessage(playerid, COLOR_WHITE, string);
	}