SA-MP Forums Archive
WTF is this for bullshit, why doesn't it work.... - 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: WTF is this for bullshit, why doesn't it work.... (/showthread.php?tid=129301)



WTF is this for bullshit, why doesn't it work.... - RSC_Quicker - 21.02.2010

Hello, I was scripting my point system for my factions, When I made a /aresetpoint, the name doesn't change and stay " ".
I got exactly the same as my faction system and that works perfect....
Код:
	if(strcmp(cmd, "/aresetpoint", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_RED, "» /aresetpoint [pointid 0-9]");
				return 1;
			}
			new factionid = strval(tmp);
			if (PlayerStats[playerid][Admin] >= 20)
			{
				DynamicPoints[factionid][Price] = 0;
				strmid(DynamicPoints[factionid][PointName], "NoneName", 0, strlen(string), 255);
				strmid(DynamicPoints[factionid][CurrentOwner], "Nobody", 0, strlen(string), 255);
				format(string, sizeof(string), "» You have reset Point ID: %d.", factionid);
				SendClientMessage(playerid, COLOR_YELLOW, string);
				SavePoints();
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "» Your not an administrator or an administrator with the required level.");
			}
		}
		return 1;
	}
Faction:

Код:
	if(strcmp(cmd, "/aresetfaction", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_RED, "» /aresetfaction [factionid]");
				return 1;
			}
			new factionid = strval(tmp);
			if (PlayerStats[playerid][Admin] >= 20)
			{
				new rank;
				format(string, sizeof(string), "Family%d",factionid);
				strmid(DynamicFactions[factionid][fName], string, 0, strlen(string), 255);
				DynamicFactions[factionid][fX] = 0.0;
				DynamicFactions[factionid][fY] = 0.0;
				DynamicFactions[factionid][fZ] = 0.0;
				DynamicFactions[factionid][fMaterials] = 0;
				DynamicFactions[factionid][fDrugs] = 0;
				DynamicFactions[factionid][fBank] = 0;
				rank = 1; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank1], string, 0, strlen(string), 255);
				rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank2], string, 0, strlen(string), 255);
				rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank3], string, 0, strlen(string), 255);
				rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank4], string, 0, strlen(string), 255);
				rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank5], string, 0, strlen(string), 255);
				rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank6], string, 0, strlen(string), 255);
				rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank7], string, 0, strlen(string), 255);
				rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank8], string, 0, strlen(string), 255);
				rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank9], string, 0, strlen(string), 255);
				rank ++; format(string, sizeof(string), "Rank%d",rank); strmid(DynamicFactions[factionid][fRank10], string, 0, strlen(string), 255);
				DynamicFactions[factionid][fSkin1] = 0;
				DynamicFactions[factionid][fSkin2] = 0;
				DynamicFactions[factionid][fSkin3] = 0;
				DynamicFactions[factionid][fSkin4] = 0;
				DynamicFactions[factionid][fSkin5] = 0;
				DynamicFactions[factionid][fSkin6] = 0;
				DynamicFactions[factionid][fSkin7] = 0;
				DynamicFactions[factionid][fSkin8] = 0;
				DynamicFactions[factionid][fSkin9] = 0;
				DynamicFactions[factionid][fSkin10] = 0;
				DynamicFactions[factionid][fJoinRank] = 0;
				DynamicFactions[factionid][fUseSkins] = 0;
				DynamicFactions[factionid][fType] = 0;
				DynamicFactions[factionid][fRankAmount] = 0;
				DynamicFactions[factionid][fMembers] = 0;
				DynamicFactions[factionid][SpawnWep1] = 0;
				DynamicFactions[factionid][SpawnWep2] = 0;
				DynamicFactions[factionid][fUseColor] = 0;
				DynamicFactions[factionid][fArmor] = 0;
				format(string, sizeof(string), "0xFFFFFFFF");
				strmid(DynamicFactions[factionid][fColor], string, 0, strlen(string), 255);
				strmid(DynamicFactions[factionid][fColorName], "None", 0, strlen(string), 255);
				strmid(DynamicFactions[factionid][fOwnerName], "Nobody", 0, strlen(string), 255);
				format(string, sizeof(string), "» You have reset Family ID: %d.", factionid);
				SendClientMessage(playerid, COLOR_YELLOW, string);
				SaveDynamicFactions();
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "» Your not an administrator or an administrator with the required level.");
			}
		}
		return 1;
	}
WTF? I get sick of it , Maybe somebody of you guys see it?


Re: WTF is this for bullshit, why doesn't it work.... - RSC_Quicker - 21.02.2010

Second mystery, My points saving is also fucked up. Also for no reason. WTF...
Point1 = Good
Point2 = wrong (Coord X = 0.00000)
Point3 = Good
Point4 = wrong (Coord X = 0.00000)
Point5 = Good
Point6 = wrong (Coord X = 0.00000)
Point7 = Good
Point8 = wrong (Coord X = 0.00000)
Point9 = Good
Point10 = wrong (Coord X = 0.00000)
wtf??

Код:
public SavePoints()
{
	new idx;
	new File: file2;
	while (idx < sizeof(DynamicPoints))
	{

		new coordsstring[512];
		format(coordsstring, sizeof(coordsstring), "%f|%f|%f|%d|%d|%s|%s\n",
		DynamicPoints[idx][fpX],
		DynamicPoints[idx][fpY],
		DynamicPoints[idx][fpZ],
		DynamicPoints[idx][Price],
		DynamicPoints[idx][Pickupid],
		DynamicPoints[idx][PointName],
		DynamicPoints[idx][CurrentOwner]);
		if(idx == 0)
		{
			file2 = fopen("points.cfg", io_write);
		}
		else
		{
			file2 = fopen("points.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
}