SA-MP Forums Archive
Command not working - 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: Command not working (/showthread.php?tid=144945)



Command not working - sobolanux - 29.04.2010

Hi there, it`s kinda late to me so I`m going to post it fast. I made a simple /save command which saves your postion and rotationa angle into a .ini file. The only problem is that when I do /save it does .... NUTHING.... maybe I`m just too tired to find the issues. If you can help, I would be very grateful

Код:
dcmd_save(playerid, params[])
{
	#pragma unused params
	new Float:x, Float:y, Float:z, Float:a, string[128], file[128], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, a);
	format(string, sizeof(string), "%f, %f, %f, %f", x, y, z, a);
	format(file, sizeof(file), "\\Misc\\%s.ini", pname);
	if(!dini_Exists(file))
	{
		dini_Create(file);
		dini_Set(file, "position", string);
		SendClientMessage(playerid, COLOUR_RED, "Position saved!");
		return 1;
	}
	else
	{
		dini_Set(file, "position", string);
		SendClientMessage(playerid, COLOUR_RED, "Position saved!");
		return 1;
	}
 	return 1;
}



Re: Command not working - Hiddos - 29.04.2010

I thought folders were indicated with just ONE '\' instead of TWO ('\\')


Re: Command not working - Backwardsman97 - 30.04.2010

Yeah I think you're formatting your file position incorrectly. Try it like this.

pawn Код:
format(file, sizeof(file), "/Misc/%s.ini", pname);
Or change the folder name to however your scriptfiles are set up.


Re: Command not working - sobolanux - 30.04.2010

Umm no, that`s not the problem because my register system is like that.

Код:
				new pname[MAX_PLAYER_NAME], file[128], string[128];
				GetPlayerName(playerid, pname, sizeof(pname));
				format(file, sizeof(file), "\\Users\\%s.ini", pname);
				dini_Create(file);



Re: Command not working - Torran - 30.04.2010

Your command isent working because your trying to do: /save, Which is a client-side command or w/e you call it,
There may be other problems but change the name of your command.. Otherwise it wont work at all

Same with /q and /quit too