/*|==============||=====rTele====||====by Razo===||==============|*/#include <a_samp>#include <zcmd>#include <sscanf2>#define MAX_TELE 64#define SCM(%0,%1,%2) SendClientMessage(%0,%1,%2)#define SCMTA(%0,%1) SendClientMessageToAll(%0,%1)#define COLOR_RED 0xEB000FFF#define ABLAK_TELE 1234#define TELE_STR_HOSSZ 2048enum tInfo{Nev[34],Float:tx,Float:ty,Float:tz,Float:tangle,Letette[MAX_PLAYER_NAME]};enum jInfo{Float:wpx,Float:wpy,Float:wpz};new TeleInfo[MAX_TELE][tInfo];new JatekosInfo[MAX_PLAYERS][jInfo];new TeleLetezik[MAX_TELE];new gstr[144];new bool:wp_leteve[MAX_PLAYERS];new bool:wp_enged;new bool:tp_enged;new bool:hely_enged; public OnFilterScriptInit(){print(\"\");print(\"====================\");print(\"===rTele betoltve===\");print(\"====================\");print(\"\");LoadTele();wp_enged = false;tp_enged = false;hely_enged = false;return 1;} stock pname(playerid){new pName[MAX_PLAYER_NAME];GetPlayerName(playerid, pName, MAX_PLAYER_NAME);return pName;}stock StripNL(str[]) // by y_less{newi = strlen(str);while (i-- && str <= \' \') str = \'\\0\';} SaveTele(teleid){new file[32], str[144];format(file,sizeof file,\"tele_%d\",teleid);new File:hnd = fopen(file,io_write);format(str,sizeof str,\"Poz&Nev=%.3f,%.3f,%.3f,%.3f,%s\\r\\n\",TeleInfo[teleid][tx],TeleInfo[teleid][ty],TeleInfo[teleid][tz],TeleInfo[teleid][tangle],TeleInfo[teleid][Nev]); fwrite(hnd,str);format(str,sizeof str,\"Letette=%s\\r\\n\",TeleInfo[teleid][Letette]); fwrite(hnd,str);format(str,sizeof str,\"Keszitve=%d\\r\\n\",TeleLetezik[teleid]); fwrite(hnd,str);fclose(hnd);}LoadTele(){new /*str[64],*/ File:hnd, count, filename[64], line[256], s, key[64];for(new i = 1; i < MAX_TELE; i++){ format(filename,sizeof filename,\"tele_%d\",i); if(!fexist(filename)) continue; hnd = fopen(filename,io_read); while(fread(hnd,line)) { StripNL(line); s = strfind(line,\"=\"); if(!line[0] || s<1) continue; strmid(key,line,0,s++);// if(strcmp(key,\"Nev\") == 0) strmid(TeleInfo[Nev],line,s,sizeof line); if(strcmp(key,\"Poz&Nev\") == 0) sscanf(line,\"p<,>ffffs[34]\",TeleInfo[tx],TeleInfo[ty],TeleInfo[tz],TeleInfo[tangle],TeleInfo[Nev]); else if(strcmp(key,\"Letette\") == 0) strmid(TeleInfo[Letette],line,s,sizeof line); else if(strcmp(key,\"Keszitve\") == 0) TeleLetezik = strval(line); } fclose(hnd); if(TeleLetezik) count++;}printf(\"%d teleport betoltve.\",count);} CMD:teletorol(playerid,params[]){if(IsPlayerAdmin(playerid)){ new id; if(sscanf(params,\"d\",id)) return SCM(playerid,COLOR_RED,\"Használat: {FFFFFF}/teletorol [iD]\"); else { format(gstr,sizeof gstr,\"/TDM/Szerver/tele_%d\",id); if(!fexist(gstr)) return SCM(playerid,COLOR_RED,\"Nincs ilyen teleport.\"); else { fremove(gstr); format(gstr,sizeof gstr,\"{FFFFFF}%s törölte a %d ID-jû teleportot.\",pname(playerid),id); SCMTA(-1,gstr); } }}else return SCM(playerid,COLOR_RED,\"Nem használhatod ezt a parancsot.\");return 1;}CMD:tele(playerid,params[]){if(hely_enged){new dstr[TELE_STR_HOSSZ]; for(new i = 1; i<MAX_TELE; i++) { if(TeleLetezik) { format(dstr,sizeof dstr,\"%sID: %d Név: %s\\n\",dstr,i,TeleInfo[Nev]); } } ShowPlayerDialog(playerid, ABLAK_TELE, DIALOG_STYLE_LIST, \"Teleport\", dstr, \"Tele\", \"Mégse\"); } else return SCM(playerid,COLOR_RED,\"Nincs engedélyezve ez a teleportálási mód.\");return 1;}CMD:engedtele(playerid,params[]){if(IsPlayerAdmin(playerid)){ if(isnull(params)) return SCM(playerid,COLOR_RED,\"Használat: {FFFFFF}/engedtele [Játékos/WayPoint/Hely]\"); else if(!strcmp(params,\"játékos\",true)) { if(!tp_enged) { tp_enged = true; format(gstr,sizeof gstr,\"{FFFFFF}%s engedélyezte az egymáshoz való teleportálást.\",pname(playerid)); SCMTA(-1,gstr); } else { tp_enged = false; format(gstr,sizeof gstr,\"{FFFFFF}%s letiltotta az egymáshoz való teleportálást.\",pname(playerid)); SCMTA(-1,gstr); } } else if(!strcmp(params,\"waypoint\",true)) { if(!wp_enged) { wp_enged = true; format(gstr,sizeof gstr,\"{FFFFFF}%s engedélyezte a WayPoint-ra való teleportálást. (/wp)\",pname(playerid)); SCMTA(-1,gstr); } else { wp_enged = false; format(gstr,sizeof gstr,\"{FFFFFF}%s letiltotta a WayPoint-ra való teleportálást.\",pname(playerid)); SCMTA(-1,gstr); } } else if(!strcmp(params,\"hely\",true)) { if(!hely_enged) { hely_enged = true; format(gstr,sizeof gstr,\"{FFFFFF}%s engedélyezte a helyre való teleportálást. (/tele)\",pname(playerid)); SCMTA(-1,gstr); } else { hely_enged = false; format(gstr,sizeof gstr,\"{FFFFFF}%s letiltotta a helyre való teleportálást.\",pname(playerid)); SCMTA(-1,gstr); } }}else return SCM(playerid,COLOR_RED,\"Nem használhatod ezt a parancsot.\");return 1;}CMD:ujtele(playerid,params[]){if(IsPlayerAdmin(playerid)){ new Float:asdx; new Float:y; new Float:z; new Float:angle;new nev[32];new fnev[34];GetPlayerPos(playerid,asdx,y,z);GetPlayerFacingAngle(playerid,angle);if(sscanf(params,\"s[32]\",nev)) return SCM(playerid,COLOR_RED,\"Használat: {FFFFFF}/újtele [Név]\");else{ format(gstr,sizeof gstr,\"{FFFFFF}%s létrehozott egy teleportot. Név: %s\",pname(playerid),nev); SCMTA(-1,gstr); format(fnev,34,\"%s\",nev); for(new x = 1; x<MAX_TELE; x++) { if(!TeleLetezik) { TeleLetezik = 1; TeleInfo[tx] = asdx; TeleInfo[ty] = y; TeleInfo[tz] = z; TeleInfo[tangle] = angle; TeleInfo[Nev] = fnev; TeleInfo[Letette] = pname(playerid); SaveTele(x); return 1; } } SCM(playerid,COLOR_RED,\"Már nem lehet!\");}}else return SCM(playerid,COLOR_RED,\"Nem használhatod ezt a parancsot.\");return 1;}CMD:wp(playerid,params[]){if(wp_enged){if(wp_leteve[playerid]){ if(IsPlayerInAnyVehicle(playerid)) { new veh = GetPlayerVehicleID(playerid); SetVehiclePos(veh,JatekosInfo[playerid][wpx],JatekosInfo[playerid][wpy],JatekosInfo[playerid][wpz]); SCM(playerid,-1,\"{0000FF}Teleportálva.\"); } else { SetPlayerPosFindZ(playerid,JatekosInfo[playerid][wpx],JatekosInfo[playerid][wpy],JatekosInfo[playerid][wpz]); SCM(playerid,-1,\"{0000FF}Teleportálva.\"); }}else return SCM(playerid,COLOR_RED,\"Nem jelöltél ki WayPoint-ot.\");}else return SCM(playerid,COLOR_RED,\"Nincs engedélyezve ez a teleportálási mód.\");return 1;}CMD:waypoint(playerid,params[]){return cmd_wp(playerid,params);}CMD:telehelp(playerid,params[]){SCM(playerid,-1,\"{FFFFFF}Parancsok: /tele, /wp. TAB-on játékosra kattintással teleportálhatsz, amennyiben ez engedélyezve van.\");if(IsPlayerAdmin(playerid)) SCM(playerid,-1,\"{FFFFFF}RCON admin parancsok: /ujtele, /engedtele, /teletorol\");return 1;}public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[]){ if(dialogid == ABLAK_TELE){ if(response) { new teleid; sscanf(inputtext[4],\"d\",teleid); if(IsPlayerInAnyVehicle(playerid)) { new vid = GetPlayerVehicleID(playerid); SetVehiclePos(vid,TeleInfo[teleid][tx],TeleInfo[teleid][ty],TeleInfo[teleid][tz]); SetVehicleZAngle(vid,TeleInfo[teleid][tangle]); } else { SetPlayerPos(playerid,TeleInfo[teleid][tx],TeleInfo[teleid][ty],TeleInfo[teleid][tz]); SetPlayerFacingAngle(playerid,TeleInfo[teleid][tangle]); SCM(playerid,-1,\"{0000FF}Teleportálva.\"); } }}return 0;}public OnPlayerConnect(playerid){wp_leteve[playerid] = false;return 1;}public OnPlayerClickMap(playerid,Float:fX,Float:fY,Float:fZ){JatekosInfo[playerid][wpx] = fX;JatekosInfo[playerid][wpy] = fY;JatekosInfo[playerid][wpz] = fZ;wp_leteve[playerid] = true;return 1;}public OnPlayerClickPlayer(playerid,clickedplayerid,source){new Float:x, Float:y, Float:z;GetPlayerPos(clickedplayerid,x,y,z);if(tp_enged){ if(!IsPlayerInAnyVehicle(playerid)) { SetPlayerPos(playerid,x+1,y,z); } else { new veh = GetPlayerVehicleID(playerid); SetVehiclePos(veh,x+2,y,z); }} else return SCM(playerid,COLOR_RED,\"Nincs engedélyezve ez a teleportálási mód.\");return 1;}public OnFilterScriptExit(){print(\"\");print(\"|=========================|\");print(\"|====rTele kikapcsolva====|\");print(\"|=========================|\");print(\"\");return 1;}