#include #include #include //#pragma dynamic 2040347 #define ini "No Limit Objects.ini" //----------------- new bool:debug2; new time; new Float:dist; new timer; //----------------- new MAX_OBJECTS2; enum oInfo { realid[MAX_PLAYERS], modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, bool:isset[MAX_PLAYERS] } new ObjectInfo[][oInfo]; public OnFilterScriptInit() { debug2 = false; time = 150; dist = 150.0; if(!fexist(ini)) { print(" Nie znalazlem pliku konfiguracyjnego!"); print(" Skrypt No Limit Objects nie zostanie zaladowany!"); print("W folderze scriptfiles utworz plik No Limit Objects.ini"); print("I umiesc w nim wszystkie obiekty w postaci CreateObject"); return 1; } new File:cfg = fopen(ini,io_read); new string[256]; for(MAX_OBJECTS2 = 0; fread(cfg,string); MAX_OBJECTS2++) { new start1,end1,start2,end2,start3,end3,start4,end4,start5,end5,start6,end6,start7,end7; new step = 1; if(strfind(string,"debug",true) != -1) { if(dini_Bool(ini,"debug") == 0) debug2 = false; else debug2 = true; } else if(strfind(string,"dystans",true) != -1) dist = dini_Float(ini,"dystans"); else if(strfind(string,"czas",true) != -1) time = dini_Int(ini,"czas"); else for(new i = 14; i < strlen(string); i++) { switch(step) { case 1: { if(string[i] <= '9' && string[i] >= '0') { start1 = i-1; step = 2; } } case 2: { if(string[i] == ' ' || string[i] == ',' ) { end1 = i; step = 3; } } case 3: { if((string[i] <= '9' && string[i] >= '0') || string[i] == '-') { start2 = i; step = 4; } } case 4: { if(string[i] == ' ' || string[i] == ',' ) { end2 = i; step = 5; } } case 5: { if((string[i] <= '9' && string[i] >= '0') || string[i] == '-') { start3 = i; step = 6; } } case 6: { if(string[i] == ' ' || string[i] == ',' ) { end3 = i; step = 7; } } case 7: { if((string[i] <= '9' && string[i] >= '0') || string[i] == '-') { start4 = i; step = 8; } } case 8: { if(string[i] == ' ' || string[i] == ',' ) { end4 = i; step = 9; } } case 9: { if((string[i] <= '9' && string[i] >= '0') || string[i] == '-') { start5 = i; step = 10; } } case 10: { if(string[i] == ' ' || string[i] == ',' ) { end5 = i; step = 11; } } case 11: { if((string[i] <= '9' && string[i] >= '0') || string[i] == '-') { start6 = i; step = 12; } } case 12: { if(string[i] == ' ' || string[i] == ',' ) { end6 = i; step = 13; } } case 13: { if((string[i] <= '9' && string[i] >= '0') || string[i] == '-') { start7 = i; step = 14; } } case 14: { if(string[i] == ' ' || string[i] == ')' ) { end7 = i; step = 15; } } } } ObjectInfo[MAX_OBJECTS2][modelid] = strval(gimme(string,start1,end1)); ObjectInfo[MAX_OBJECTS2][x] = floatstr(gimme(string,start2,end2)); ObjectInfo[MAX_OBJECTS2][y] = floatstr(gimme(string,start3,end3)); ObjectInfo[MAX_OBJECTS2][z] = floatstr(gimme(string,start4,end4)); ObjectInfo[MAX_OBJECTS2][rx] = floatstr(gimme(string,start5,end5)); ObjectInfo[MAX_OBJECTS2][ry] = floatstr(gimme(string,start6,end6)); ObjectInfo[MAX_OBJECTS2][rz] = floatstr(gimme(string,start7,end7)); } fclose(cfg); timer = SetTimer("NoLimitObject",time,1); print("\n+-------------------------------+"); print("| No Limit Objects |"); print("| FilterScript Loaded |"); print("| Coded By |"); print("| Mruk and homie |"); print("+-------------------------------+\n"); for(new o = 0; o < 8; o++) printf("%i",ObjectInfo[o][modelid]); return 1; } gimme(str[],index,end) { new string[10]; strmid(string,str,index,end); return string; } public OnPlayerCommandText(playerid,cmdtext[]) { new cmd[256]; new string[256]; new idx; cmd = strtok(cmdtext,idx); if(!strcmp(cmdtext,"/nlo-debug",true) && IsPlayerAdmin(playerid)) { if(!debug2) { debug2 = true; SendClientMessage(playerid,0xCCCCCCFF,"Włączyłeś No Limit Objects Debug"); } else { debug2 = false; SendClientMessage(playerid,0xCCCCCCFF,"Wyłączyłeś No Limit Objects Debug"); } return 1; } if(!strcmp(cmd,"/nlo-czas",true) && IsPlayerAdmin(playerid)) { new tmp[256]; tmp = strtok(cmdtext,idx); if(!strlen(tmp) || !IsNumeric(tmp) || strval(tmp) < 1 || strval(tmp) > 10000) { SendClientMessage(playerid,0xCCCCCCFF,"Wpisz /nlo-czas [czas w milisekundach] Np. /nlo-czas 500 ustawi czas odświeżania na pół sekundy"); SendClientMessage(playerid,0xCCCCCCFF,"Jedna sekunda to tysiąc milisekund. Domyślnie odświeżanie jest ustawione na 150 ms"); return 1; } time = strval(tmp); KillTimer(timer); timer = SetTimer("NoLimitObject",time,1); format(string,sizeof(string),"Ustawiłeś czas odświeżania obiektów na %i sekund (%i milisekund)",time/1000,time); SendClientMessage(playerid,0xCCCCCCFF,string); return 1; } if(!strcmp(cmd,"/nlo-dystans",true) && IsPlayerAdmin(playerid)) { new tmp[256]; tmp = strtok(cmdtext,idx); if(!strlen(tmp) || !IsFloat(tmp) || floatstr(tmp) < 1.0 || floatstr(tmp) > 10000.0) { SendClientMessage(playerid,0xCCCCCCFF,"Wpisz /nlo-dystans [odległość] Np. /nlo-dystans 200.0 ustawi odległość wyświetlania obiektów na 200.0 jednostek"); SendClientMessage(playerid,0xCCCCCCFF,"Jedna jednostka to mniej więcej metr. Domyślnie dystans jest ustawiony na 150.0 jednostek"); return 1; } dist = floatstr(tmp); format(string,sizeof(string),"Ustawiłeś odległość wyświetlania obiektów na %f jednostek",dist); SendClientMessage(playerid,0xCCCCCCFF,string); return 1; } return 0; } forward NoLimitObject(); public NoLimitObject() { for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) { if(IsPlayerConnected(playerid)) { for(new arrid = 0; arrid < MAX_OBJECTS2; arrid++) { if(PlayerToPoint(dist,playerid,ObjectInfo[arrid][x],ObjectInfo[arrid][y],ObjectInfo[arrid][z])) { if(!ObjectInfo[arrid][isset][playerid]) { ObjectInfo[arrid][realid][playerid] = CreatePlayerObject(playerid,ObjectInfo[arrid][modelid],ObjectInfo[arrid][x],ObjectInfo[arrid][y],ObjectInfo[arrid][z],ObjectInfo[arrid][rx],ObjectInfo[arrid][ry],ObjectInfo[arrid][rz]); ObjectInfo[arrid][isset][playerid] = true; if(debug2) printf("Object Created %i %i",arrid,ObjectInfo[arrid][realid][playerid]); } } else if(ObjectInfo[arrid][isset][playerid]) { DestroyPlayerObject(playerid,ObjectInfo[arrid][realid][playerid]); ObjectInfo[arrid][isset][playerid] = false; if(debug2) printf("Object Destroyed %i %i",arrid,ObjectInfo[arrid][realid][playerid]); } } } } } forward PlayerToPoint(Float:radi, playerid, Float:x2, Float:y2, Float:z2); public PlayerToPoint(Float:radi, playerid, Float:x2, Float:y2, Float:z2) { if(IsPlayerConnected(playerid)) { new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); tempposx = (oldposx -x2); tempposy = (oldposy -y2); tempposz = (oldposz -z2); //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { return 1; } } return 0; } IsNumeric(const string[]) { for (new i = 0, j = strlen(string); i < j; i++) { if (string[i] > '9' || string[i] < '0') return 0; } return 1; } IsFloat(const string[]) { for (new i = 0, j = strlen(string); i < j; i++) { if ((string[i] > '9' || string[i] < '0') && string[i] != '.') return 0; } return 1; }