RemoveWorldObject (MTA Code)
#7

Did you check all the code? That's an example of replacement of RemoveWorldObject to RemoveBuildingForPlayer, there are no just Checkpoints but Spawnpoints, objects and so. What I wanted to show you with the code is how I did the replacement but it didn't work in-game, I mean, it didn't remove the world objects when you play the race. Check this part of the code of the Gamemode:
Код:
funcion LoadAutoRace(rName[])
{
	new File[128],
	    Str[9][40],
	    buf[50],
	    count,
	    obcount,
	    picount,
	    spawnco,
	    mapname[64],
	    time[12]
		;
	format(File,128,"/RacesNew/%s/meta.xml",rName);
	if(!fexist(File))return printf("%s no existe!",File);
	new XML:Map = xml_open(File);
	xml_get_string(Map,"meta/info/@name",RaceName);
	xml_get_string(Map,"meta/map/@src",mapname);
	xml_get_string(Map,"meta/settings/setting[1]/@value",time);
	RaceWeather = xml_get_int(Map,"meta/settings/setting[2]/@value");
	xml_close(Map);
	sscanf(time,"p<:>d",RaceHour);
	format(File,128,"/RacesNew/%s/%s",rName,mapname);
	if(!fexist(File))return printf("%s no existe!",File);
	Map = xml_open(File);
    new spawnp = xml_get_int(Map,"count(map/spawnpoint)");
    new Objectp = xml_get_int(Map,"count(map/object)");
    new Racepick = xml_get_int(Map,"count(map/racepickup)");
    new Checkpo = xml_get_int(Map,"count(map/checkpoint)");
    new Max1 = max(spawnp,Objectp);
    new Max2 = max(Checkpo,Racepick);
    new Max = max(Max1,Max2);
    for(new a=1,b=Max+1; a<b; a++)
	{
		if(Objectp != 0 && Objectp >= a)
 		{
			for(new c=0; c<sizeof(ObjAttr); c++)
			{
            	format(Str[c], sizeof(Str[]), "map/object[%d]/@%s",a,ObjAttr[c]);
            }
            rObje[obcount] = CreateDynamicMagObject(xml_get_int(Map,Str[0]),xml_get_float(Map,Str[1]),xml_get_float(Map,Str[2]),xml_get_float(Map,Str[3]),xml_get_float(Map,Str[4]),xml_get_float(Map,Str[5]),xml_get_float(Map,Str[6]));
            obcount++;
            if(obcount>=8000){
			printf("%s/%s The number of the objects is too much",rName,mapname);
			return 0;
			}
		}
        if(spawnp != 0 && spawnp >=a)
        {
            for(new c=0; c<sizeof(spawnpoint); c++)
            {
                format(Str[c], sizeof(Str[]), "map/spawnpoint[%d]/@%s",a,spawnpoint[c]);
			}
			RaceVehCoords[spawnco][0] = xml_get_float(Map,Str[0]);
			RaceVehCoords[spawnco][1] = xml_get_float(Map,Str[1]);
			RaceVehCoords[spawnco][2] = xml_get_float(Map,Str[2]);
			RaceVehCoords[spawnco][3] = xml_get_float(Map,Str[3]);
			if(RaceVehCoords[spawnco][3] != RaceVehCoords[spawnco][3]){
			format(Str[3], sizeof(Str[]), "map/spawnpoint[%d]/@rotZ",a);
			RaceVehCoords[spawnco][3] = xml_get_float(Map,Str[3]);
			}
			RaceVehicle = xml_get_int(Map,Str[4]);
			spawnco++;
		}
		if(Racepick != 0 && Racepick >=a)
		{
		    for(new c=0; c<sizeof(PickAttr); c++)
            {
                format(Str[c], sizeof(Str[]), "map/racepickup[%d]/@%s",a,PickAttr[c]);
			}
			xml_get_string(Map,Str[3],buf);
            if(!strcmp(buf,"nitro",true))
            {
            nospid[picount] = CreateRacePickup(picount,1010,23,xml_get_float(Map,Str[0]),xml_get_float(Map,Str[1]),xml_get_float(Map,Str[2]));
            vehchlabel[picount] = CreateDynamic3DTextLabel("{FFFFFF}10X {15FF00}Nitro",-1,xml_get_float(Map,Str[0]),xml_get_float(Map,Str[1]),xml_get_float(Map,Str[2])+0.7,100.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,10);
			Iter_Add(nosp,picount);
			}else if(!strcmp(buf,"repair",true)){
            repid[picount] = CreateRacePickup(picount,3096,23,xml_get_float(Map,Str[0]),xml_get_float(Map,Str[1]),xml_get_float(Map,Str[2]));
            Iter_Add(rep,picount);
			}else{
            vehch[picount] = CreateRacePickup(picount,2485,23,xml_get_float(Map,Str[0]),xml_get_float(Map,Str[1]),xml_get_float(Map,Str[2]));
            vehchcar[picount] = xml_get_int(Map,Str[4]);
            Iter_Add(vehp,picount);
            format(buf,50,"{FFFFFF}-- {D6A374}%s {FFFFFF}--",VehNames[vehchcar[picount]-400]);
            vehchlabel[picount] = CreateDynamic3DTextLabel(buf,-1,xml_get_float(Map,Str[0]),xml_get_float(Map,Str[1]),xml_get_float(Map,Str[2])+0.7,100.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,10);
            }
            picount++;
		}
		if(Checkpo != 0 && Checkpo >=a)
		{
		    for(new c=0; c<sizeof(checkpoint); c++)
            {
                format(Str[c], sizeof(Str[]), "map/checkpoint[%d]/@%s",a,checkpoint[c]);
			}
			CPCoords[count][0] = xml_get_float(Map,Str[0]);
			CPCoords[count][1] = xml_get_float(Map,Str[1]);
			CPCoords[count][2] = xml_get_float(Map,Str[2]);
			count++;
		}
	}
	xml_close(Map);
	yarissiratimer = SetTimer("ccarreras",500,true);
	TotalCP = count;

	aralika1 = ((21.0)/(TotalCP));
	aralika2 = (187.0/TotalCP);
	raceslot = spawnco;
	Position = 0;
	FinishCount = 0;
	JoinCount = 0;
	Loop(x, 2) PlayersCount[x] = 0;
	CountAmount = COUNT_DOWN_TILL_RACE_START;
	RaceTime = MAX_RACE_TIME;
	RaceBusy = 0x01;
	KillTimer(CountTimer);
	CountTimer = SetTimer("CountTillRace", 999, 1);
	Iter_Clear(racer);
	return 1;
}
As you can see, to make work PickUps, Spawnpoints, Objects and Checkpoints with MTA codes which are located inside the .map file, there's a script code right there to make em work, what is missing is the code for RemoveWorldObject. I hope you got my point now xd.
Reply


Messages In This Thread
RemoveWorldObject (MTA Code) - by leon44 - 06.07.2018, 08:33
Re: RemoveWorldObject (MTA Code) - by Banditul18 - 06.07.2018, 08:49
Re: RemoveWorldObject (MTA Code) - by leon44 - 06.07.2018, 19:35
Re: RemoveWorldObject (MTA Code) - by Sew_Sumi - 06.07.2018, 21:33
Re: RemoveWorldObject (MTA Code) - by leon44 - 06.07.2018, 22:15
Re: RemoveWorldObject (MTA Code) - by Sew_Sumi - 07.07.2018, 02:25
Re: RemoveWorldObject (MTA Code) - by leon44 - 07.07.2018, 05:48
Re: RemoveWorldObject (MTA Code) - by Sew_Sumi - 08.07.2018, 03:06

Forum Jump:


Users browsing this thread: 1 Guest(s)