Advertisement
Guest User

Untitled

a guest
May 6th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. stock LoadMap(path[], Float:offZ = 0.0){
  2. if(UnloadMap())
  3. {
  4. new loadstr[400],mapValues[mapData],count;
  5. if(!fexist(path))return 0;
  6. new File:fhandle = fopen(path,io_read);
  7. new IchStinke;
  8. while(fread(fhandle, loadstr))
  9. {
  10. if(!loadstr[0])continue;
  11. if(!sscanf(loadstr, "p<\">'object''model='d'posX='f'posY='f'posZ='f'rotX='f'rotY='f'rotZ='f",mapValues[pMmodelid], mapValues[pMX], mapValues[pMY], mapValues[pMZ], mapValues[pMRX], mapValues[pMRY], mapValues[pMRZ])){
  12. DerbyObjects[IchStinke] = CreateDynamicObject(mapValues[pMmodelid], mapValues[pMX], mapValues[pMY], mapValues[pMZ]+offZ, mapValues[pMRX], mapValues[pMRY], mapValues[pMRZ],-1,-1,-1,300.0,300.0);
  13. printf("Objects: %i", DerbyObjects[d]);
  14. }else if(!sscanf(loadstr, "p<\">'racepickup''type='s[30]'vehicle='d'posX='f'posY='f'posZ='f'rotX='f'rotY='f'rotZ='f",mapValues[pMtype],mapValues[pMmodelid], mapValues[pMX], mapValues[pMY], mapValues[pMZ], mapValues[pMRX], mapValues[pMRY], mapValues[pMRZ])){
  15. if(strcmp(mapValues[pMtype],"nitro") == 0)CreateRacePickup(mapValues[pMX], mapValues[pMY], mapValues[pMZ]+offZ,1);
  16. else if(strcmp(mapValues[pMtype],"repair") == 0) CreateRacePickup(mapValues[pMX], mapValues[pMY], mapValues[pMZ]+offZ,2);
  17. else if(strcmp(mapValues[pMtype],"vehiclechange") == 0)CreateRacePickup(mapValues[pMX], mapValues[pMY], mapValues[pMZ]+offZ,3,mapValues[pMmodelid]);
  18. }else if(!sscanf(loadstr, "p<\">'spawnpoint''vehicle='d'posX='f'posY='f'posZ='f'rotX='f'rotY='f'rotZ='f",mapValues[pMmodelid], mapValues[pMX], mapValues[pMY], mapValues[pMZ], mapValues[pMRX], mapValues[pMRY], mapValues[pMRZ])){
  19. ++count;
  20. CreateRaceSpawn(mapValues[pMmodelid], mapValues[pMX], mapValues[pMY], mapValues[pMZ]+offZ, mapValues[pMRZ],count);
  21. }else if(!sscanf(loadstr, "p<\">'marker''color='s[10]'posX='f'posY='f'posZ='f",mapValues[pMtype],mapValues[pMX], mapValues[pMY], mapValues[pMZ])){
  22. mapValues[pMmodelid] = CreateDynamicObject(1559,mapValues[pMX], mapValues[pMY], mapValues[pMZ]+offZ,0.0,0.0,0.0,-1,-1,-1,400.0,400.0);
  23. mapValues[pMcolorID] = ConvertStringToHex(mapValues[pMtype]);
  24. SetDynamicObjectMaterial(mapValues[pMmodelid], 0, 1231, "dynsigns", "white64", mapValues[pMcolorID]);
  25. }else if(!sscanf(loadstr, "p<\">'speedboost''posX='f'posY='f'posZ='f'veloX='f'veloY='f'veloZ='f", mapValues[pMX], mapValues[pMY], mapValues[pMZ], mapValues[pMRX], mapValues[pMRY], mapValues[pMRZ])){
  26. CreateRacePickup(mapValues[pMX], mapValues[pMY], mapValues[pMZ]+offZ,4, 0 ,mapValues[pMRX], mapValues[pMRY], mapValues[pMRZ]);
  27. } else if(!sscanf(loadstr, "p<\">'teleport''posX='f'posY='f'posZ='f'nposX='f'nposY='f'nposZ='f'rotX='f'rotY='f'rotZ='f",mapValues[pMX], mapValues[pMY], mapValues[pMZ], mapValues[pMRX], mapValues[pMRY], mapValues[pMRZ],mapValues[pNMRZ],mapValues[pNMRZ],mapValues[pNMRZ])){
  28. CreateRacePickup(mapValues[pMX], mapValues[pMY], mapValues[pMZ]+offZ,5 , 0 ,mapValues[pMRX], mapValues[pMRY], mapValues[pMRZ]+offZ,mapValues[pNMRZ]);
  29. }
  30. IchStinke++;
  31. }
  32. fclose(fhandle);
  33. if(!count)return print("Map konnte nicht geladen werden"),0;
  34. print("Map wurde geladen");
  35. strdel(path,strfind(path,"objects.map"),strlen(path));
  36. strdel(loadstr,0,sizeof(loadstr));
  37. format(loadstr,40,"%smeta.xml",path);
  38. LoadFromMeta(loadstr);
  39. }
  40. return 1;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement