if(strcmp(command, "/loadmap", true) == 0 ) { strcat(TextArguments, ".map"); if (!dini_Exists(TextArguments)) { SendClientMessage(playerid, 0xFFFF0000, "ERROR: map does not exist!"); return 1; } new File:fwhnd=fopen(TextArguments,io_read); new tmpres[256]; new param[256]; new tmpint[3]; new Float:tmpfloat[9]; while (fread(fwhnd,tmpres)) // while we're reading lines.. { new idx2; // "%i %i %i %f %f %f %f %f %f" for (new i = 0; i <= 8; i++) { param = strtok(tmpres, idx2); switch (i) { case 0 .. 2: tmpint[i] = strval(param); case 3 .. 8: tmpfloat[i] = floatstr(param); } } new LoadedObject = CreateObject(tmpint[2], tmpfloat[3], tmpfloat[4], tmpfloat[5], tmpfloat[6], tmpfloat[7], tmpfloat[8]); CreatedObjects++; ObjectPool[CreatedObjects] = LoadedObject; ModelID[ObjectPool[CreatedObjects]] = tmpint[2]; } fclose(fwhnd); format(tmp, sizeof(tmp), "%s loaded map '%s'!", Who, TextArguments); ircSay(1,"#jacob",tmp); SendClientMessageToAll(0xFFFF0000, tmp); return 1; } if(strcmp(command, "/savemap", true) == 0 ) { new SaveFile[2000]; for (new i=1; i<=CreatedObjects; i++) { if (!ObjectPool[i]) goto fuck; // object does not exist! GetObjectPos(ObjectPool[i], x, y, z); GetObjectRot(ObjectPool[i], rX, rY, rZ); format(tmp, sizeof(tmp), "%i %i %i %f %f %f %f %f %f", i, ObjectPool[i], ModelID[ObjectPool[i]], x, y, z, rX, rY, rZ); strcat(SaveFile, tmp); strcat(SaveFile, "\n"); fuck: } format(tmp,sizeof(tmp),"%s.map",TextArguments); if (!dini_Exists(tmp)) { printf("\nError: '%s' does not exist. New file created.", tmp); dini_Create(tmp); } new File:map=fopen(tmp,io_write); fwrite(map,SaveFile); fclose(map); format(command, sizeof(command), "All created objects have been saved! (%s)", tmp); SendClientMessageToAll(0xFFFF0000, command); ircSay(1,"#jacob",command); printf(SaveFile); return 1; }