11.11.2018, 10:00
Hello everybody, can you help me how I can optimize that gamemode?
Код:
/*Modifikacija pradėta kurti 2018-09-26 Autorius: ©Ponas_Algelis */ //=============================== { INCLUDE'AI } =============================== #include <YSI\y_timers> #include <timerfix> #include <a_mysql> #include <sscanf2> #include <streamer> #include <zcmd> //============================================================================== #undef MAX_PLAYERS #define MAX_PLAYERS 300 //============================================================================== //=============================== { FORWARD'AI } =============================== forward Zaidimas(); forward Greitis(); forward TekstoValymas(playerid); forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5); //============================================================================== //=============================== { DEFINE'AI } ================================ #define MySQL_HOST "localhost" #define MySQL_USER "root" #define MySQL_DATA "serveris" #define MySQL_PASS "" #define HOLDING(%0) \ ((newkeys & (%0)) == (%0)) #define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) #define DLG_RADIJAS 0 #define DLG_INFO 1 #define DLG_REGISTRACIJA 2 #define DLG_PRISIJUNGIMAS 3 #define AUKSINE 0xE6B800FF //============================================================================== new bool:GTRezimas[MAX_VEHICLES]; new PlayerText:Textdraw[4][MAX_PLAYERS]; new Float:LigoninesAtsiradimoVietos[][] = { {171.6668,-42.2873,1.5781, 90.0000}, {160.6668,-42.2873,1.5781, 90.0000} }; enum _playerData { pPrazaide, pSkin, pPinigai, pPatirtis, pLygis, pKreditai, pVIP, pAdmin }; new playerData[MAX_PLAYERS][_playerData]; new bool: online[MAX_PLAYERS]; new bool: from_login[MAX_PLAYERS]; new bool: from_reg[MAX_PLAYERS]; new trylog[MAX_PLAYERS]; //============================================================================== main(){} public OnGameModeInit() { SetGameModeText("VER 0.00.1"); mysql_debug( true ); mysql_connect( MySQL_HOST,MySQL_USER,MySQL_DATA,MySQL_PASS ); mysql_set_charset("utf8"); if( mysql_ping( ) >= 1 ) print( "\nPrisijungėte prie duomenų bazės.\n\n"); else print("Nepavyko prisijungti prie MySQL duomenų bazės!\n"); DisableInteriorEnterExits(); UsePlayerPedAnims(); EnableStuntBonusForAll(0); SetNameTagDrawDistance(20.0); return 1; } //============================================================================== public OnGameModeExit() { for(new i=0; i < MAX_PLAYERS; i++) { if( IsPlayerConnected(i) && online[i] ) MySQL_Save(i); } mysql_close( ); return 1; } //============================================================================== public OnPlayerRequestClass(playerid, classid) { new Query[ 200 ]; format( Query,sizeof( Query ),"SELECT * FROM `zaidejai` WHERE vardas = '%s'",GetPlayerNameEx( playerid ) ); mysql_query( Query ); mysql_store_result( ); if( mysql_num_rows( ) ) { RodytiPrisijungima(playerid); } else { RodytiRegistracija(playerid); } mysql_free_result( ); return 1; } //============================================================================== public OnPlayerConnect(playerid) { if (IsPlayerNPC(playerid)) { return 1; } online[playerid] = false; trylog[playerid] = 0; SendClientMessage(playerid, 0xFFFF00FF, "SVEIKAS ATVYKĘS Į SERVERĮ"); Textdrawai(playerid); return 1; } //============================================================================== public OnPlayerDisconnect(playerid, reason) { if( online[playerid] ) { MySQL_Save(playerid); SleptiTextdrawus(playerid); } return 1; } //============================================================================== public OnPlayerSpawn(playerid) { if( !online[playerid] ) Kick(playerid); if( from_login[playerid] ) { MySQL_Load(playerid); from_login[playerid] = false; return 1; } if( from_reg[playerid] ) { from_reg[playerid] = false; return 1; } return 1; } //============================================================================== public OnPlayerDeath(playerid, killerid, reason) { for(new p = 0; p < MAX_PLAYERS; p++) { SleptiTextdrawus(p); MoveToHospital(p); GameTextForPlayer(p,"~r~MIRETE!",5000,4); } return 1; } //============================================================================== public OnVehicleSpawn(vehicleid) { for(new p = 0; p < MAX_PLAYERS; p++) { if(IsPlayerConnected(p)) { SleptiTextdrawus(p); } } return 1; } //============================================================================== public OnVehicleDeath(vehicleid, killerid) { return 1; } //============================================================================== public OnPlayerText(playerid, text[]) { new Keiksmazodziai[][] = { "SARG","LMG","DOGBERRY","LIBERTY",".LT",".RU",".EN",".DE" }; for(new i; i != sizeof(Keiksmazodziai); ++i) { PakeistiKeiksmazodi(text, Keiksmazodziai[i]); } new pname[MAX_PLAYER_NAME], str[64]; GetPlayerName(playerid, pname, MAX_PLAYER_NAME); if(playerData[playerid][pAdmin] <4) { format(str, sizeof(str), "%s sako: {006699}%s", pname, text); ProxDetector(25.0, playerid, str, -1, -1, -1, -1, -1); } if(playerData[playerid][pAdmin] == 4) { format(str, sizeof(str), "%s: %s", pname, text); ProxDetector(30.0, playerid, str, 0x18BD09FF, 0x18BD09FF, 0x18BD09FF, 0x18BD09FF, 0x18BD09FF); } return 0; } public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5) { if(IsPlayerConnected(playerid)) { new Float:posx, Float:posy, Float:posz; new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))) { GetPlayerPos(i, posx, posy, posz); tempposx = (oldposx -posx); tempposy = (oldposy -posy); tempposz = (oldposz -posz); if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) { SendClientMessage(i, col1, string); } else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) { SendClientMessage(i, col2, string); } else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) { SendClientMessage(i, col3, string); } else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) { SendClientMessage(i, col4, string); } else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { SendClientMessage(i, col5, string); } } else { SendClientMessage(i, col1, string); } } } return 1; } //============================================================================== public OnPlayerCommandPerformed( playerid, cmdtext[ ], success ) { if(!success ) { return SendClientMessage( playerid, 0xFF0000FF, "Tokios komandos nėra!"); } return 1; } //============================================================================== public OnPlayerCommandText(playerid, cmdtext[]) { return 0; } //============================================================================== public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { return 1; } //============================================================================== public OnPlayerExitVehicle(playerid, vehicleid) { return 1; } //============================================================================== public OnPlayerStateChange(playerid, newstate, oldstate) { for(new i; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { if(newstate == PLAYER_STATE_DRIVER) { SendClientMessage(i, 0x999999FF, "Kad būtų linksmiau vaћiuoti, įsijunk radiją {006699}/radijas"); } if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) { PlayerTextDrawShow(i, Textdraw[0][i]); PlayerTextDrawShow(i, Textdraw[1][i]); PlayerTextDrawShow(i, Textdraw[2][i]); } if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) { SleptiTextdrawus(i); } } } return 1; } //============================================================================== public OnPlayerEnterCheckpoint(playerid) { return 1; } //============================================================================== public OnPlayerLeaveCheckpoint(playerid) { return 1; } //============================================================================== public OnPlayerEnterRaceCheckpoint(playerid) { return 1; } //============================================================================== public OnPlayerLeaveRaceCheckpoint(playerid) { return 1; } //============================================================================== public OnRconCommand(cmd[]) { return 1; } //============================================================================== public OnPlayerRequestSpawn(playerid) { return 1; } //============================================================================== public OnObjectMoved(objectid) { return 1; } //============================================================================== public OnPlayerObjectMoved(playerid, objectid) { return 1; } //============================================================================== public OnPlayerPickUpPickup(playerid, pickupid) { return 1; } //============================================================================== public OnVehicleMod(playerid, vehicleid, componentid) { return 1; } //============================================================================== public OnVehiclePaintjob(playerid, vehicleid, paintjobid) { return 1; } //============================================================================== public OnVehicleRespray(playerid, vehicleid, color1, color2) { return 1; } //============================================================================== public OnPlayerSelectedMenuRow(playerid, row) { return 1; } //============================================================================== public OnPlayerExitedMenu(playerid) { return 1; } //============================================================================== public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) { return 1; } //============================================================================== public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if( IsPlayerInAnyVehicle( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) { new masina = GetPlayerVehicleID( playerid ) ; if( GTRezimas[ masina ] ) { if (HOLDING (KEY_SPRINT)) { if( GetPlayerSpeed( masina ) < 50 ) { new Float:vehx, Float:vehy, Float:vehz ; GetVehicleVelocity( masina, vehx, vehy, vehz ); SetVehicleVelocity( masina, vehx * 1.4, vehy * 1.4, vehz * 1.4 ); } } } } if (PRESSED(KEY_YES)) { Radijas(playerid); } return 1; } //============================================================================== public OnRconLoginAttempt(ip[], password[], success) { return 1; } //============================================================================== public OnPlayerUpdate(playerid) { return 1; } //============================================================================== public OnPlayerStreamIn(playerid, forplayerid) { return 1; } //============================================================================== public OnPlayerStreamOut(playerid, forplayerid) { return 1; } //============================================================================== public OnVehicleStreamIn(vehicleid, forplayerid) { return 1; } //============================================================================== public OnVehicleStreamOut(vehicleid, forplayerid) { return 1; } //============================================================================== public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if( dialogid == DLG_REGISTRACIJA ) //Registracija { if( response ) { new pw[40]; mysql_real_escape_string(inputtext, pw); if( !strlen( pw ) ) { SendClientMessage( playerid,0xFF0000FF,"Laukelis negali būti tuљčias." ); RodytiRegistracija(playerid); return 1; } if( strlen( pw ) > 40 ) { SendClientMessage( playerid,0xFF0000FF,"Slaptaћodis negali būti ilgesnis nei 40simbolių." ); RodytiRegistracija(playerid); return 1; } new Query[ 150 ]; format( Query,sizeof( Query ),"INSERT INTO `zaidejai` (vardas,slaptazodis) VALUES ('%s','%s')",GetPlayerNameEx( playerid ), pw ); mysql_query( Query ); online[playerid] = true; from_reg[playerid] = true; SpawnPlayer(playerid); SetPlayerPos(playerid, -1969.5012,137.9058,27.6875); GivePlayerMoney (playerid, 70000); SetPlayerScore (playerid, 0); SetPlayerHealth(playerid, 200); SetPlayerSkin(playerid, 250); } else { Kick( playerid ); } return 1; } if( dialogid == DLG_PRISIJUNGIMAS ) //Prisijungimas { if( response ) { new pw[40]; mysql_real_escape_string(inputtext, pw); if( strlen( pw ) > 40 ) { SendClientMessage( playerid,0xFF0000FF,"Slaptaћodis negali būti ilgesnis nei 40simbolių." ); RodytiPrisijungima(playerid); return 1; } new Query[ 150 ] ; format( Query,sizeof( Query ),"SELECT * FROM `zaidejai` WHERE vardas = '%s' AND slaptazodis = '%s'",GetPlayerNameEx( playerid ),pw ); mysql_query( Query ); mysql_store_result( ); if(! mysql_num_rows( ) ) { if(trylog[playerid] > 2) { SendClientMessage(playerid, 0xFF0000FF, "Norėdamas(-a) iљeiti, raљyk /q"); Kick(playerid); } trylog[playerid]++; SendClientMessage(playerid, 0xFF0000FF, "Neteisingas slaptaћodis!"); RodytiPrisijungima(playerid); } else { UzsaldytiZaideja(playerid, 2000); SpawnPlayer(playerid); GameTextForPlayer(playerid,"~y~SVEIKAS SUGRIZES I SERVERI!",4000,5); online[playerid] = true; from_login[playerid] = true; return 1; } mysql_free_result( ); return 1; } if( !response ) { Kick( playerid ); } return 1; } if(dialogid == DLG_RADIJAS) { if(!response) return 1; switch(listitem) { case 0: { PlayAudioStreamForPlayer(playerid, "http://84.46.205.13:80/rc128.mp3"); GameTextForPlayer(playerid, "~b~Radiocentras",1500,4); } case 1: { PlayAudioStreamForPlayer(playerid, "http://radio.m-1.fm/lietus/mp3"); GameTextForPlayer(playerid, "~b~Lietus",2500,4); } case 2: { PlayAudioStreamForPlayer(playerid, "http://radio.m-1.fm:80/m1/mp3"); GameTextForPlayer(playerid, "~b~M-1",2500,4); } case 3: { PlayAudioStreamForPlayer(playerid, "http://radio.m-1.fm:80/m1plius/mp3"); GameTextForPlayer(playerid, "~b~M-1 Plius",2500,4); } case 4: { PlayAudioStreamForPlayer(playerid, "http://5.20.223.18:80/rrb128.mp3"); GameTextForPlayer(playerid, "~b~Ruskoje Radio",2500,4); } case 5: { PlayAudioStreamForPlayer(playerid, "http://84.46.205.13:80/zipfm128.mp3"); GameTextForPlayer(playerid, "~b~ZIP FM",2500,4); } case 6: { PlayAudioStreamForPlayer(playerid, "http://82.135.234.195:8000/fm99.mp3"); GameTextForPlayer(playerid, "~b~FM99",2500,4); } case 7: { PlayAudioStreamForPlayer(playerid, "http://82.135.234.195:8000/kelyje_klaipeda.mp3"); GameTextForPlayer(playerid, "~b~Kelyje Klaipeda",2500,4); } case 8: { PlayAudioStreamForPlayer(playerid, "http://82.135.234.195:8000/kelyje_kaunas.mp3"); GameTextForPlayer(playerid, "~b~Kelyje Kaunas",2500,4); } case 9: { PlayAudioStreamForPlayer(playerid, "http://82.135.234.195:8000/ehr.mp3"); GameTextForPlayer(playerid, "~b~European Hit Radio",2500,4); } case 10: { PlayAudioStreamForPlayer(playerid, "http://5.20.223.18:80/relaxfm128.mp3"); GameTextForPlayer(playerid, "~b~Relax FM",2500,4); } case 11: { PlayAudioStreamForPlayer(playerid, "http://listen2.myradio24.com:9000/8608"); GameTextForPlayer(playerid, "~b~Baltracker",2500,4); } case 12: { PlayAudioStreamForPlayer(playerid, "http://82.135.234.195:8000/extrafm.mp3"); GameTextForPlayer(playerid, "~b~Extra FM",2500,4); } case 13: { PlayAudioStreamForPlayer(playerid, "http://gyvai.utenosradijas.lt:8010/Utenosradijas"); GameTextForPlayer(playerid, "~b~Utenos radijas",2500,4); } case 14: { PlayAudioStreamForPlayer(playerid, "http://82.135.234.195:8000/gerasfm.mp3"); GameTextForPlayer(playerid, "~b~Geras FM",2500,4); } case 15: { StopAudioStreamForPlayer(playerid); GameTextForPlayer(playerid, "~r~Isjungete radija!",2500,4); SendClientMessage(playerid, 0xFF0000FF , "Iљjungėte radiją."); } } } return 1; } //============================================================================== public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; } //================================ { KOMANDOS } ================================ CMD:gt(playerid) { if(playerData[playerid][pAdmin] <4) return SendClientMessage( playerid, 0xFFFF00FF, "Aha, norėtum..." ); if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage( playerid, 0xFF0000FF, "Turi būti tr. priemonėje!" ); new masina = GetPlayerVehicleID( playerid ); if( GTRezimas[ masina ] ) { SendClientMessage( playerid, 0xFF0000FF, "GT IЉJUNGTAS!" ); GTRezimas[ masina ] = false; PlayerTextDrawHide(playerid, Textdraw[3][playerid]); } else { SendClientMessage( playerid, 0xFFFF00FF, "GT ĮJUNGTAS!" ); GTRezimas[ masina ] = true; PlayerTextDrawShow(playerid, Textdraw[3][playerid]); } return 1; } //============================================================================== CMD:taisyti(playerid) { if(playerData[playerid][pVIP] == 0) return SendClientMessage(playerid, 0xFF0000FF, "Komanda skirta tik VIP nariams!"); if(playerData[playerid][pVIP] >0) { if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Turi būti tr.priemonėje!"); RepairVehicle(GetPlayerVehicleID(playerid)); GivePlayerMoney(playerid, -500); SendClientMessage(playerid, 0xFFFF00FF, "Tr.priemonė suremontuota! Remonto kaina 500Ђ"); } return 1; } //============================================================================== CMD:radijas(playerid,params[]) { Radijas(playerid); return 1; } //============================================================================== CMD:vip(playerid,params[]) { new string[140]; if(isnull(params)) return SendClientMessage(playerid, 0xFF0000FF, "Raљyti vip nariams naudok /vip"); if(playerData[playerid][pVIP] == 0) return SendClientMessage(playerid, 0xFF0000FF, "Komanda skirta tik VIP nariams!"); if(playerData[playerid][pVIP] >0) { format(string, 140, "[VIP]%s: %s", GetPlayerNameEx(playerid), params); } SendClientMessageToAll(0x339966FF,string); return 1; } //============================================================================== CMD:sav(playerid,params[]) { new string[100]; if(playerData[playerid][pAdmin] <4) return SendClientMessage( playerid, 0xFF0000FF, "Tik savininkui!" ); { format(string, 100, "[SAVININKAS] %s: %s", GetPlayerNameEx(playerid), params); } SendClientMessageToAll(0xE68A00FF,string); return 1; } //============================================================================== CMD:rr(playerid,params[]) { new string[52]; if(playerData[playerid][pAdmin] <4) return SendClientMessage( playerid, 0xFF0000FF, "Tik savininkui!" ); { format(string, 52, "<> RESTARTAS: %s <>",params); } SendClientMessageToAll(0xE68A00FF,string); return 1; } //============================================================================== CMD:info(playerid) { ZaidejoInformacija(playerid); return 1; } //============================================================================== CMD:refresh(playerid) { TogglePlayerControllable(playerid,true); SetPlayerVirtualWorld( playerid, 0 ); SetPlayerInterior( playerid, 0 ); return 1; } //============================================================================== //================================ { STOCK'AI } ================================ stock MySQL_Save(playerid) { if( online[playerid] ) { new Float: pos[3], // 0,1,2 - pozicija; Query[512]; printf("Iљsaugomas %s", GetPlayerNameEx(playerid)); GetPlayerPos(playerid,pos[0],pos[1],pos[2]); format( Query,sizeof( Query ),"UPDATE `zaidejai` SET x = '%f', y = '%f', z = '%f' WHERE vardas = '%s'",\ pos[0], pos[1], pos[2], GetPlayerNameEx( playerid )); mysql_query( Query ); playerData[playerid][pSkin] = GetPlayerSkin(playerid); playerData[playerid][pPinigai] = GetPlayerMoney(playerid); playerData[playerid][pPatirtis] = GetPlayerScore(playerid); format( Query, sizeof(Query),"UPDATE `zaidejai` SET skin = '%i', pinigai = '%i', patirtis = '%i',prazaide = '%i', lygis = '%i', kreditai = '%i', vip = '%i', admin = '%i' WHERE vardas = '%s'", playerData[playerid][pSkin], playerData[playerid][pPinigai], playerData[playerid][pPatirtis], playerData[playerid][pPrazaide],playerData[playerid][pLygis],playerData[playerid][pKreditai], playerData[playerid][pVIP],playerData[playerid][pAdmin], GetPlayerNameEx(playerid)); mysql_query( Query ); new Float:HP, Float:ARM; GetPlayerArmour(playerid, ARM); GetPlayerHealth(playerid, HP); format(Query, sizeof(Query), "UPDATE `zaidejai` SET hp = '%f', armour = '%f' WHERE vardas = '%s'",\ HP,ARM, GetPlayerNameEx(playerid)); mysql_query(Query); } return 1; } //============================================================================== stock MySQL_Load(playerid) { new Float: pos[3], // 0,1,2 - pozicija; fetch[16], Query[256]; format(Query, sizeof(Query), "SELECT * FROM `zaidejai` WHERE vardas = '%s'", GetPlayerNameEx(playerid)); mysql_query(Query); mysql_store_result(); mysql_retrieve_row(); mysql_fetch_field_row( fetch, "x" ); pos[0] = floatstr(fetch); mysql_fetch_field_row( fetch, "y" ); pos[1] = floatstr(fetch); mysql_fetch_field_row( fetch, "z" ); pos[2] = floatstr(fetch); SetPlayerPos( playerid, pos[0], pos[1], pos[2] + 0.75); mysql_fetch_field_row( fetch,"skin" ); playerData[playerid][pSkin] = strval(fetch); SetPlayerSkin(playerid, playerData[playerid][pSkin]); mysql_fetch_field_row( fetch,"pinigai" ); playerData[playerid][pPinigai] = strval(fetch); GivePlayerMoney(playerid, playerData[playerid][pPinigai]); mysql_fetch_field_row( fetch,"patirtis" ); playerData[playerid][pPatirtis] = strval(fetch); SetPlayerScore(playerid, playerData[playerid][pPatirtis]); mysql_fetch_field_row( fetch,"prazaide" ); playerData[playerid][pPrazaide] = strval(fetch); mysql_fetch_field_row( fetch,"lygis" ); playerData[playerid][pLygis] = strval(fetch); mysql_fetch_field_row( fetch,"kreditai" ); playerData[playerid][pKreditai] = strval(fetch); mysql_fetch_field_row( fetch,"VIP" ); playerData[playerid][pVIP] = strval(fetch); mysql_fetch_field_row( fetch,"Admin" ); playerData[playerid][pAdmin] = strval(fetch); new Float: HP, Float: ARM; mysql_fetch_field_row( fetch,"hp" ); HP = floatstr( fetch ); SetPlayerHealth( playerid, HP); mysql_fetch_field_row( fetch,"armour" ); ARM = floatstr( fetch ); SetPlayerArmour( playerid, ARM); mysql_free_result(); printf("Pakrautas ћaidėjas. [%s]", GetPlayerNameEx(playerid)); return 1; } //============================================================================== stock GetPlayerNameEx( playerid ) { new Vardas[ MAX_PLAYER_NAME ]; GetPlayerName( playerid,Vardas,MAX_PLAYER_NAME ); return Vardas; } //============================================================================== stock MoveToHospital(playerid) { { new Float:h[2]; SetPlayerInterior(playerid, 3); SetPlayerHealth(playerid, 200); UzsaldytiZaideja(playerid, 800); h[0] = GetPlayerDistanceFromPoint(playerid, LigoninesAtsiradimoVietos[0][0], LigoninesAtsiradimoVietos[0][1], LigoninesAtsiradimoVietos[0][2]); h[1] = GetPlayerDistanceFromPoint(playerid, LigoninesAtsiradimoVietos[1][0], LigoninesAtsiradimoVietos[1][1], LigoninesAtsiradimoVietos[1][2]); if(h[0] < h[1]) { SetSpawnInfo(playerid, GetPlayerTeam(playerid), GetPlayerSkin(playerid), LigoninesAtsiradimoVietos[0][0], LigoninesAtsiradimoVietos[0][1], LigoninesAtsiradimoVietos[0][2], LigoninesAtsiradimoVietos[0][3], 0, 0, 0, 0, 0, 0); } else { SetSpawnInfo(playerid, GetPlayerTeam(playerid), GetPlayerSkin(playerid), LigoninesAtsiradimoVietos[0][0], LigoninesAtsiradimoVietos[0][1], LigoninesAtsiradimoVietos[0][2], LigoninesAtsiradimoVietos[0][3], 0, 0, 0, 0, 0, 0); } } } //============================================================================== stock UzsaldytiZaideja(playerid, Time) { for(new i=0; i<MAX_PLAYERS; i++) { TogglePlayerControllable(playerid, false); SetTimerEx("UnfreezePlayer", Time, false, "d", i); } return 1; } //============================================================================== stock PakeistiKeiksmazodi(string[], Keiksmazodziai[],Simbolis = '*') { new i; while((i = strfind(string, Keiksmazodziai, true)) != -1) { for(new x = (i + strlen(Keiksmazodziai)); i != x; ++i) { string[i] = Simbolis; } } return 1; } //============================================================================== stock strmatch(const String1[], const String2[]) { if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1))) { return true; } else { return false; } } //============================================================================== stock ZaidejoInformacija(playerid) { new String[512], Stringas[512+(MAX_PLAYER_NAME)],Lygiai = 54, Vip[20], Admin[20]; switch(playerData[playerid][pVIP]) { case 1: Vip = "{006699}BRONZINIS"; case 2: Vip = "{006699}SIDABRINIS"; case 3: Vip = "{006699}AUKSINIS"; default: Vip = "Neturi"; } switch(playerData[playerid][pAdmin]) { case 1: Admin = "{006699}1 lygio"; case 2: Admin = "{006699}2 lygio"; case 3: Admin = "{006699}3 lygio"; case 4: Admin = "{006699}Pagrindinis"; default: Admin = "Neturi"; } format(Stringas, sizeof(Stringas), "{999999}Vardas: {006699}%s\n\ {999999}Lygis: {006699}%d/%d\n\ {999999}Kreditai: {006699}%d\n\ {999999}VIP: {006699}%s\n\ {999999}Administratorius: {006699}%s\n\ {999999}Patirtis: {006699}%d {999999}xp\n\ {999999}Pinigai: {006699}%d {999999}Ђ\n\ Praћaista: {006699}%d {999999}min.", GetPlayerNameEx(playerid), playerData[playerid][pLygis], Lygiai, playerData[playerid][pKreditai], Vip, Admin, GetPlayerScore(playerid), GetPlayerMoney(playerid), playerData[playerid][pPrazaide]);strcat(String, Stringas); ShowPlayerDialog(playerid, DLG_INFO, DIALOG_STYLE_MSGBOX, "{999999}Ћaidėjo informacija", String, "{999999}Gerai", ""); return 1; } //============================================================================== stock RodytiRegistracija(playerid) { new registracija[364+(MAX_PLAYER_NAME)];format(registracija, sizeof(registracija), "{e6e6e6}Sveikas {ff9900}%s\n{e6e6e6}Љiame serveryje esi pirmą kartą, todėl norėdamas ћaisti\n\ turi uћsiregistruoti,\nsugalvok savo slaptaћodį, kurį naudosi ateityje.\n\ {32cd32}\tSlaptaћodį turi sudaryti maћiausiai 8 simboliai, ir ne daugiau kaip 40 simbolių\n\ \tĮterpk į slaptaћodį skaičių bei didћiųjų raidћių, kad būtų kuo sunkesnis", GetPlayerNameEx( playerid )); ShowPlayerDialog(playerid, DLG_REGISTRACIJA, DIALOG_STYLE_INPUT, "Registracija", registracija, "Tęsti", "Baigti"); } //============================================================================== stock RodytiPrisijungima(playerid) { new prisijungimas[128+(MAX_PLAYER_NAME)]; format(prisijungimas, sizeof(prisijungimas), "{e6e6e6}Sveikas {ff9900}%s {e6e6e6}sugriћęs\nĮvesk savo slaptaћodį", GetPlayerNameEx( playerid )); ShowPlayerDialog(playerid, DLG_PRISIJUNGIMAS, DIALOG_STYLE_PASSWORD, "Prisijungimas", prisijungimas, "Tęsti", "Baigti"); } //============================================================================== stock Textdrawai(playerid) { //Spidometras Textdraw[0][playerid] = CreatePlayerTextDraw(playerid, 639.000000, 412.750000, "usebox"); PlayerTextDrawLetterSize(playerid, Textdraw[0][playerid], 0.000000, -0.025000); PlayerTextDrawTextSize(playerid, Textdraw[0][playerid], 458.500000, 0.000000); PlayerTextDrawAlignment(playerid, Textdraw[0][playerid], 1); PlayerTextDrawColor(playerid, Textdraw[0][playerid], 0); PlayerTextDrawUseBox(playerid, Textdraw[0][playerid], true); PlayerTextDrawBoxColor(playerid, Textdraw[0][playerid], 102); PlayerTextDrawSetShadow(playerid, Textdraw[0][playerid], 0); PlayerTextDrawSetOutline(playerid, Textdraw[0][playerid], 0); PlayerTextDrawFont(playerid, Textdraw[0][playerid], 0); //////////////////////////////////////////////////////////////////////////// Textdraw[1][playerid] = CreatePlayerTextDraw(playerid, 460.500000, 395.500000, "GREITIS: 222 KM/H"); PlayerTextDrawLetterSize(playerid, Textdraw[1][playerid], 0.449999, 1.600000); PlayerTextDrawAlignment(playerid, Textdraw[1][playerid], 1); PlayerTextDrawColor(playerid, Textdraw[1][playerid], 0x969696FF); PlayerTextDrawSetShadow(playerid, Textdraw[1][playerid], 0); PlayerTextDrawSetOutline(playerid, Textdraw[1][playerid], 1); PlayerTextDrawBackgroundColor(playerid, Textdraw[1][playerid], 255); PlayerTextDrawFont(playerid, Textdraw[1][playerid], 2); PlayerTextDrawSetProportional(playerid, Textdraw[1][playerid], 1); //////////////////////////////////////////////////////////////////////////// Textdraw[2][playerid] = CreatePlayerTextDraw(playerid, 461.500000, 414.312500, "BUKLE: 1000"); PlayerTextDrawLetterSize(playerid, Textdraw[2][playerid], 0.449999, 1.600000); PlayerTextDrawAlignment(playerid, Textdraw[2][playerid], 1); PlayerTextDrawColor(playerid, Textdraw[2][playerid], 0x969696FF); PlayerTextDrawSetShadow(playerid, Textdraw[2][playerid], 0); PlayerTextDrawSetOutline(playerid, Textdraw[2][playerid], 1); PlayerTextDrawBackgroundColor(playerid, Textdraw[2][playerid], 255); PlayerTextDrawFont(playerid, Textdraw[2][playerid], 2); PlayerTextDrawSetProportional(playerid, Textdraw[2][playerid], 1); //////////////////////////////////////////////////////////////////////////// Textdraw[3][playerid] = CreatePlayerTextDraw(playerid, 461.500000, 427.437500, "GT"); PlayerTextDrawLetterSize(playerid, Textdraw[3][playerid], 0.449999, 1.600000); PlayerTextDrawAlignment(playerid, Textdraw[3][playerid], 1); PlayerTextDrawColor(playerid, Textdraw[3][playerid], -16776961); PlayerTextDrawSetShadow(playerid, Textdraw[3][playerid], 0); PlayerTextDrawSetOutline(playerid, Textdraw[3][playerid], 1); PlayerTextDrawBackgroundColor(playerid, Textdraw[3][playerid], 255); PlayerTextDrawFont(playerid, Textdraw[3][playerid], 2); PlayerTextDrawSetProportional(playerid, Textdraw[3][playerid], 1); } //============================================================================== stock SleptiTextdrawus(playerid) { PlayerTextDrawHide(playerid, Textdraw[0][playerid]); PlayerTextDrawHide(playerid, Textdraw[1][playerid]); PlayerTextDrawHide(playerid, Textdraw[2][playerid]); PlayerTextDrawHide(playerid, Textdraw[3][playerid]); } //============================================================================== stock GetPlayerSpeed(playerid) { new Float:ST[4]; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]); else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]); ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 200.25000; return floatround(ST[3]); } stock Radijas(playerid) { ShowPlayerDialog(playerid, DLG_RADIJAS, DIALOG_STYLE_LIST, "Radijas", "Radiocentras\n\ Lietus\nM-1\nM-1 Plius\nRuskoje Radio\nZIP FM\nFM99\nKelyje (Klaipėda)\nKelyje (Kaunas)\n\ EuropeanHitRadio\nRelax FM\nBaltracker\nExtra FM\nUtenos radijas\n\ Geras FM\nIљjungti radiją", "Gerai", "Baigti"); } //============================================================================== //=============================== { TIMERIAI } ================================= task Greitis[100]() { for(new i; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { if(IsPlayerInAnyVehicle(i)) { new getInfo[100], Float:bukle; format(getInfo, 50, "GREITIS: ~b~~h~%i KM/H", GetPlayerSpeed(i)); PlayerTextDrawSetString(i, Textdraw[1][i], getInfo); GetVehicleHealth(GetPlayerVehicleID(i), bukle); format(getInfo, 50, "BUKLE: ~y~%.0f", bukle/1); PlayerTextDrawSetString (i, Textdraw[2][i], getInfo); } } } } //============================================================================== task TekstoValymas[7000](playerid) { for(new i; i < MAX_PLAYERS; i++) { SendClientMessage(i, 0x999999FF, ""); } return 1; } //============================================================================== task Zaidimas[60000]() { for(new p; p < MAX_PLAYERS; p++) { if (IsPlayerConnected(p)) { playerData[p][pPrazaide] ++; SetPlayerScore(p,GetPlayerScore(p)+5); GivePlayerMoney(p, 50); } new XP[55] = {10,30,55,350,500,600,1000,1100,1250,1300,1400,1600,2000,2200, 2500,2650,2700,3000,3500,3700,4100,4150,4200,4500,5000,5550,5600,6000,6125,6410, 6700,8000,8125,8200,8250,8270,8350,8500,8600,9000,20000,21150,50000,80000,85000, 150000,350000,500000,550000,1000000,1050000,1500000,2000000,3500000}; for(new i = 0; i != sizeof(XP); i++) { if(GetPlayerScore(p) == XP[i]) { playerData[p][pLygis] ++; playerData[p][pKreditai] ++; SetPlayerScore(p,GetPlayerScore(p)+10); new str[70]; format(str, 70, "[APDOVANOJIMAS]Pasiekėte %d lygį bei gavote 1 kreditą ir 10 XP", playerData[p][pLygis]); SendClientMessage(p, AUKSINE, str); } } } return 1; } //==============================================================================