SA-MP Forums Archive
Name won't save, help - 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: Name won't save, help (/showthread.php?tid=208984)



Name won't save, help - Outcast - 09.01.2011

I want to save some player's name in a .ini file. It's for my faction script and I can't make it to save as text, instead it always save as a number (82).

Код:
COMMAND:setleader1(playerid, params[])
	{
		new leaderid;
	   	if(sscanf(params, "u", leaderid)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /setleader1 [playerID]");
        GetPlayerName(leaderid, FactionSFPD[playerid][fLeader], MAX_PLAYER_NAME);
		dini_IntSet(SERVER_FACTION_SFPD_FILE, "Leaderl",FactionSFPD[playerid][fLeader]);
		SendClientMessage(playerid, COLOR_YELLOW, "You are now a leader of SFPD (faction 1)");
		return 1;
	}
What am I doing wrong?


Re: Name won't save, help - JaTochNietDan - 09.01.2011

Well it's quite simple, you're writing it as an integer using the dini_IntSet function. You need to use the dini_Set function for a string. Like so:

pawn Код:
dini_Set(SERVER_FACTION_SFPD_FILE, "Leaderl",FactionSFPD[playerid][fLeader]);



AW: Name won't save, help - Kmitska - 09.01.2011

You should add it into your register system instead of creating an own file.