17.05.2016, 13:27
Hey, I bulid derby gm and after register or login the objects map not load.
ongamemodeinit:
LoadMap();
ongamemodeinit:
LoadMap();
Код:
function LoadMap()
{
new string[128], mapid, src[128], author[128], name[128];
new XML:file2 = xml_open("Maps/maplist.xml");
mapid = random(xml_get_int(file2, "count(maps/map)")+1);
format(string, sizeof(string), "maps/map[%d]/@src", mapid);
xml_get_string(file2, string, src);
format(string, sizeof(string), "maps/map[%d]/@author", mapid);
xml_get_string(file2, string, author);
format(string, sizeof(string), "maps/map[%d]/@name", mapid);
xml_get_string(file2, string, name);
xml_close(file2);
format(string, sizeof(string), "Maps/%s.map", src);
new XML:file = xml_open(string);
if(file)
{
gInfo[gMapID] = mapid;
strcpy(gInfo[gName], name, 128);
strcpy(gInfo[gAuthor], author, 128);
strcpy(gInfo[gPath], src, 128);
new mapname[47];
format(mapname, sizeof(mapname), "mapname %s", name);
SendRconCommand(mapname);
for(new i = 1, j = xml_get_int(file, "count(map/object)"); i < j; i++)
{
new model, Float:pos[6];
format(string, sizeof(string), "map/object[%d]/@model", i);
model = xml_get_int(file, string);
format(string, sizeof(string), "map/object[%d]/@posX", i);
pos[0] = xml_get_float(file, string);
format(string, sizeof(string), "map/object[%d]/@posY", i);
pos[1] = xml_get_float(file, string);
format(string, sizeof(string), "map/object[%d]/@posZ", i);
pos[2] = xml_get_float(file, string);
format(string, sizeof(string), "map/object[%d]/@rotX", i);
pos[3] = xml_get_float(file, string);
format(string, sizeof(string), "map/object[%d]/@rotY", i);
pos[4] = xml_get_float(file, string);
format(string, sizeof(string), "map/object[%d]/@rotZ", i);
pos[5] = xml_get_float(file, string);
gInfo[gObject][gInfo[gObjectCount]] = CreateDynamicObject(model, pos[0], pos[1], pos[2], pos[3], pos[4], pos[5], -1, -1, -1, 200.0, 0.0);
gInfo[gObjectCount] ++;
}
for(new i = 1, j = xml_get_int(file, "count(map/racepickup)"); i < j; i++)
{
new picktype[256], pickvehicle, picktypeint, Float:pos[3];
format(string, sizeof(string), "map/racepickup[%d]/@type", i);
xml_get_string(file, string, picktype);
format(string, sizeof(string), "map/racepickup[%d]/@vehicle", i);
pickvehicle = xml_get_int(file, string);
format(string, sizeof(string), "map/racepickup[%d]/@posX", i);
pos[0] = xml_get_float(file, string);
format(string, sizeof(string), "map/racepickup[%d]/@posY", i);
pos[1] = xml_get_float(file, string);
format(string, sizeof(string), "map/racepickup[%d]/@posZ", i);
pos[2] = xml_get_float(file, string);
if(!strcmp(picktype, "repair"))
{
puInfo[gInfo[gPickupCount]][puTextLabel] = CreateDynamic3DTextLabel("[{00B2EE}Repair{FFFFFF}]", 0xFFFFFFFF, pos[0], pos[1], pos[2], 50.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
picktypeint = 1;
} else if(!strcmp(picktype, "nitro")) {
puInfo[gInfo[gPickupCount]][puTextLabel] = CreateDynamic3DTextLabel("[{00B2EE}Nitro{FFFFFF}]", 0xFFFFFFFF, pos[0], pos[1], pos[2], 50.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
picktypeint = 2;
} else if(!strcmp(picktype, "vehiclechange")) {
format(string, sizeof(string), "[{00B2EE}%s{FFFFFF}]", VehiclesName[pickvehicle - 400]);
puInfo[gInfo[gPickupCount]][puTextLabel] = CreateDynamic3DTextLabel(string, 0xFFFFFFFF, pos[0], pos[1], pos[2], 50.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
picktypeint = 3;
} else if(!strcmp(picktype, "vehiclechangerepair")) {
format(string, sizeof(string), "[{00B2EE}%s {FFFFFF}+ {00B2EE}Repair{FFFFFF}]", VehiclesName[pickvehicle - 400]);
puInfo[gInfo[gPickupCount]][puTextLabel] = CreateDynamic3DTextLabel(string, 0xFFFFFFFF, pos[0], pos[1], pos[2], 50.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
picktypeint = 4;
} else if(!strcmp(picktype, "nitrorepair")) {
format(string, sizeof(string), "[{00B2EE}Nitro {FFFFFF}+ {00B2EE}Repair{FFFFFF}]", VehiclesName[pickvehicle - 400]);
puInfo[gInfo[gPickupCount]][puTextLabel] = CreateDynamic3DTextLabel(string, 0xFFFFFFFF, pos[0], pos[1], pos[2], 50.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
picktypeint = 5;
}
puInfo[gInfo[gPickupCount]][puVehicle] = pickvehicle;
for(new p, s = 3; p < s; p++)
{
puInfo[gInfo[gPickupCount]][puPos][p] = pos[p];
}
puInfo[gInfo[gPickupCount]][puType] = picktypeint;
gInfo[gPickupCount] ++;
}
for(new i = 1, j = xml_get_int(file, "count(map/spawnpoint)"); i < j; i++)
{
new vehicleid, Float:pos[4];
format(string, sizeof(string), "map/spawnpoint[%d]/@vehicle", i);
vehicleid = xml_get_int(file, string);
format(string, sizeof(string), "map/spawnpoint[%d]/@posX", i);
pos[0] = xml_get_float(file, string);
format(string, sizeof(string), "map/spawnpoint[%d]/@posY", i);
pos[1] = xml_get_float(file, string);
format(string, sizeof(string), "map/spawnpoint[%d]/@posZ", i);
pos[2] = xml_get_float(file, string);
format(string, sizeof(string), "map/spawnpoint[%d]/@rotZ", i);
pos[3] = xml_get_float(file, string);
vsInfo[gInfo[gVehicleSpawnCount]][vsVehicleID] = vehicleid;
for(new p, s = 4; p < s; p++)
{
vsInfo[gInfo[gVehicleSpawnCount]][vsPos][p] = pos[p];
}
gInfo[gVehicleSpawnCount] ++;
}
} else {
xml_close(file);
LoadMap();
return 1;
}
xml_close(file);
return 1;
}

