SA-MP Forums Archive
Help for a little job! - 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: Help for a little job! (/showthread.php?tid=141342)



Help for a little job! - sobolanux - 12.04.2010

Hi there. I have a little problem. I`m trying to make a little job for a RP server, and it gives me this error : error 033: array must be indexed

Код:
dcmd_goduty(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 3, 2371.9854, 2759.2981, 10.8203) == 1)
	{
	  new file[128], pname[MAX_PLAYER_NAME], job[256];
	  job = dini_Get(file, "job");
		GetPlayerName(playerid, pname, sizeof(pname));
		if(GetPlayerState(playerid) == 1 && job == 1)
		{
		  SendClientMessage(playerid, COLOR_GOLD, "Now go and get a garbage truck and do your job!");
  	}
  	else SendClientMessage(playerid, COLOR_GOLD, "You must be on foot! Get out of the vehicle.");
  	return 1;
	}
	else SendClientMessage(playerid, COLOR_GOLD, "You don`t have that job or you are not at the duty position!");
	return 1;
}
dcmd_takejob(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 3, 2371.9854, 2759.2981, 10.8203) == 1)
	{
	  new file[128], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(file, sizeof(file), "\\Users\\%s.ini", pname);
		dini_IntSet(file, "job", 1);
		SendClientMessage(playerid, COLOR_GOLD, "Congratulations with your new job!");
	}
	return 1;
}



Re: Help for a little job! - M4S7ERMIND - 12.04.2010

Since job is an integrer in your file, you need to replace job[256] to job and dini_Get(file, "job") to dini_Int(file, "job").


Re: Help for a little job! - sobolanux - 12.04.2010

Oh! How helpful! Alot of thanks man!