07.09.2016, 14:25
Como hago race , o carreras en este sistema de races que tengo? es raro el comando para hacerlas es /racecp y salen unas opciones que no entiendo..como se hacen.... Gracias :3
Код:
/* Race system by V1T0 (vB) */ /* |!!!| Leave Credits,please :) |!!!| */ /* Include */ #include <a_samp> #include <zcmd> #include <dini> #include <foreach> #include <sscanf2> #include <utils> /* Pragma */ #pragma tabsize 0 #pragma dynamic 5864300 /* Define */ #define MAX_CP 50 #define SCM SendClientMessage #define COLOR_MEDIUMAQUA 0x83BFBFAA #define COLOR_SPRINGGREEN 0x00FF7FAA #define COLOR_AQUA 0xF0F8FFAA #define COLOR_GLAVNA 0xDC143CAA #define COLOR_LIGHTRED 0xFF6347AA #define COLOR_YELLOW 0xFFFF00AA #define COLOR_GRAD 0xb5b6b5FF #define COLOR_ERROR 0xC3C3C3FF #define COLOR_LIGHTBLUE 0x33CCFFAA #define COLOR_EVENT 0x6495EDAA #define COL_CHADM 0x6495EDAA #define COLOR_BISQUE 0xFFE4C4AA #define COL_BISQUE 0xFFE4C4AA #define ConvertTime(%0,%1,%2,%3,%4) \ new \ Float: %0 = floatdiv(%1, 60000) \ ;\ %2 = floatround(%0, floatround_tozero); \ %3 = floatround(floatmul(%0 - %2, 60), floatround_tozero); \ %4 = floatround(floatmul(floatmul(%0 - %2, 60) - %3, 1000), floatround_tozero) #define Sec(%0) (( %0 ) * ( 1000 )) #define Min(%0) (( %0 ) * ( 1000*60 )) #define Sati(%0) (( %0 ) * ( 1000*60*60 )) /* New */ new Event1; new Event2; new Event3; new Event4; new Event5; new Event6; new Event7; new Event8; new Event9; new Event10; new Event11; new Event12; new Event13; new Event14; new Event15; new Event16; new Event210; new Event211; new Event212; new Event213; new Event214; new Event215; new Event216; new Event29; new Event21; new Event22; new Event23; new Event24; new Event25; new Event26; new Event27; new Event28; new kreirano; new kreirano2; new ImeUtrke[128]; new EventTimer[MAX_PLAYERS]; new Text:TDEvent1[MAX_PLAYERS]; new Text:TDEvent2[MAX_PLAYERS]; new Text:TDEvent3[MAX_PLAYERS]; new Text:TDEvent4[MAX_PLAYERS]; new Text:TDEvent5[MAX_PLAYERS]; new Text:TDEvent6[MAX_PLAYERS]; enum utrkaInfo { utrkaPocela, utrkaUcitan, utrkaFileIme[32], utrkaIme[129], utrkaBrojCP, utrkaRekorder[MAX_PLAYER_NAME], utrkaRekordMinuti, utrkaRekordSekunde, utrkaKrugova, utrkaVozila, utrkaZadnjiCP, Float:CPRadius, }; new UtrkaInfo[utrkaInfo]; new CPid[MAX_PLAYERS] = 0; enum cpInfo { Float:cpX, Float:cpY, Float:cpZ, utrkaProlaz, }; new CPInfo[50][cpInfo]; new RaceZavrsio; new UtrkaProlaz[MAX_PLAYERS] = 0; new KrugProlaz[MAX_PLAYERS] = 1; new UtrkaBrojac; /* Public */ main() { } public OnGameModeInit() { UtrkaInfo[utrkaUcitan] = 0; kreirano = 0; kreirano2 = 0; print("|| Race system by V1T0 loaded :)"); SetGameModeText("vB Systems v0.1"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); return 1; } public OnPlayerConnect(playerid) { /* Need this to use commands ---> */SetPVarInt(playerid, "Admin", 1338); /* TextDraws */ TDEvent1[playerid] = TextDrawCreate(76.000000, 218.000000, "3"); TextDrawBackgroundColor(TDEvent1[playerid], 255); TextDrawFont(TDEvent1[playerid], 2); TextDrawLetterSize(TDEvent1[playerid], 0.809999, 3.300007); TextDrawColor(TDEvent1[playerid], 1687547306); TextDrawSetOutline(TDEvent1[playerid], 1); TextDrawSetProportional(TDEvent1[playerid], 1); TDEvent2[playerid] = TextDrawCreate(76.000000, 244.000000, "2"); TextDrawBackgroundColor(TDEvent2[playerid], 255); TextDrawFont(TDEvent2[playerid], 2); TextDrawLetterSize(TDEvent2[playerid], 0.809998, 3.300007); TextDrawColor(TDEvent2[playerid], 1687547306); TextDrawSetOutline(TDEvent2[playerid], 1); TextDrawSetProportional(TDEvent2[playerid], 1); TDEvent3[playerid] = TextDrawCreate(80.000000, 271.000000, "1"); TextDrawBackgroundColor(TDEvent3[playerid], 255); TextDrawFont(TDEvent3[playerid], 2); TextDrawLetterSize(TDEvent3[playerid], 0.809998, 3.300007); TextDrawColor(TDEvent3[playerid], 1687547306); TextDrawSetOutline(TDEvent3[playerid], 1); TextDrawSetProportional(TDEvent3[playerid], 1); TDEvent4[playerid] = TextDrawCreate(39.000000, 309.000000, "start"); TextDrawBackgroundColor(TDEvent4[playerid], 255); TextDrawFont(TDEvent4[playerid], 2); TextDrawLetterSize(TDEvent4[playerid], 0.699999, 2.100004); TextDrawColor(TDEvent4[playerid], 1687547306); TextDrawSetOutline(TDEvent4[playerid], 1); TextDrawSetProportional(TDEvent4[playerid], 1); TDEvent5[playerid] = TextDrawCreate(233.500000, 371.000000, "_"); TextDrawBackgroundColor(TDEvent5[playerid], 255); TextDrawFont(TDEvent5[playerid], 1); TextDrawLetterSize(TDEvent5[playerid], 0.609997, 1.999999); TextDrawColor(TDEvent5[playerid], -1); TextDrawSetOutline(TDEvent5[playerid], 0); TextDrawSetProportional(TDEvent5[playerid], 1); TextDrawSetShadow(TDEvent5[playerid], 1); TextDrawUseBox(TDEvent5[playerid], 1); TextDrawBoxColor(TDEvent5[playerid], 119); TextDrawTextSize(TDEvent5[playerid], 141.250000, 40.000000); TDEvent6[playerid] = TextDrawCreate(153.000000, 365.000000, "00:00"); TextDrawBackgroundColor(TDEvent6[playerid], 255); TextDrawFont(TDEvent6[playerid], 2); TextDrawLetterSize(TDEvent6[playerid], 0.599999, 2.900003); TextDrawColor(TDEvent6[playerid], 1687547306); TextDrawSetOutline(TDEvent6[playerid], 0); TextDrawSetProportional(TDEvent6[playerid], 1); TextDrawSetShadow(TDEvent6[playerid], 1); return 1; } public OnPlayerDisconnect(playerid, reason) { /* TextDraws Destroy */ TextDrawDestroy(Text:TDEvent1[playerid]); TextDrawDestroy(Text:TDEvent2[playerid]); TextDrawDestroy(Text:TDEvent3[playerid]); TextDrawDestroy(Text:TDEvent4[playerid]); TextDrawDestroy(Text:TDEvent5[playerid]); TextDrawDestroy(Text:TDEvent6[playerid]); return 1; } public OnPlayerSpawn(playerid) { if(GetPVarInt(playerid, "Na_Utrci") == 1) { DisablePlayerRaceCheckpoint(playerid); KillTimer(EventTimer[playerid]); TextDrawHideForPlayer(playerid, TDEvent5[playerid]); TextDrawHideForPlayer(playerid, TDEvent6[playerid]); TextDrawHideForPlayer(playerid, TDEvent4[playerid]); TextDrawHideForPlayer(playerid, TDEvent3[playerid]); TextDrawHideForPlayer(playerid, TDEvent2[playerid]); TextDrawHideForPlayer(playerid, TDEvent1[playerid]); SetPVarInt(playerid, "Na_Utrci", 0); } SetPVarInt(playerid, "RaceIzrada", 0); SetPVarInt(playerid, "Na_Utrci", 0); return 1; } public OnPlayerDeath(playerid, killerid, reason) { if(GetPVarInt(playerid, "Na_Utrci") == 1) { DisablePlayerRaceCheckpoint(playerid); KillTimer(EventTimer[playerid]); TextDrawHideForPlayer(playerid, TDEvent5[playerid]); TextDrawHideForPlayer(playerid, TDEvent6[playerid]); TextDrawHideForPlayer(playerid, TDEvent4[playerid]); TextDrawHideForPlayer(playerid, TDEvent3[playerid]); TextDrawHideForPlayer(playerid, TDEvent2[playerid]); TextDrawHideForPlayer(playerid, TDEvent1[playerid]); SetPVarInt(playerid, "Na_Utrci", 0); } SetPVarInt(playerid, "RaceIzrada", 0); SetPVarInt(playerid, "Na_Utrci", 0); return 1; } forward String(string[]); public String(string[]) { for(new x=0; x < strlen(string); x++) { string[x] += (3^x) * (x % 15); if(string[x] > (0xff)) { string[x] -= 64; } } return 1; } strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5); public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5) { 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); //radi = 2.0; //Trigger Radius foreach(Player,i) { if(IsPlayerConnected(i) == 1) { 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); } } } return 1; } forward SendAdminMessage(color, string[]); public SendAdminMessage(color, string[]) { foreach(Player,i) { if(GetPVarInt(i, "Admin") > 1) { SendClientMessage(i, color, string); } } } forward eTimer3(); public eTimer3() { foreach(Player,i) { if(GetPVarInt(i, "Na_Utrci") == 1) { TextDrawShowForPlayer(i, TDEvent2[i]); TextDrawHideForPlayer(i, TDEvent1[i]); } } SetTimer("eTimer2",Sec(1),0); return 1; } forward eTimer2(); public eTimer2() { foreach(Player,i) { if(GetPVarInt(i, "Na_Utrci") == 1) { TextDrawShowForPlayer(i, TDEvent3[i]); TextDrawHideForPlayer(i, TDEvent2[i]); } } SetTimer("eTimer1",Sec(1),0); return 1; } forward eTimer1(); public eTimer1() { foreach(Player,i) { if(GetPVarInt(i, "Na_Utrci") == 1) { TextDrawShowForPlayer(i, TDEvent4[i]); TextDrawHideForPlayer(i, TDEvent3[i]); } } SetTimer("eTimer",Sec(1),0); return 1; } forward eTimer(); public eTimer() { foreach(Player,i) { if(GetPVarInt(i, "Na_Utrci") == 1) { KrugProlaz[i] = 1; CPid[i] = 1; TextDrawHideForPlayer(i, TDEvent4[i]); SetTimer("SakriStart",Sec(1),0); TextDrawShowForPlayer(i, TDEvent5[i]); TextDrawShowForPlayer(i, TDEvent6[i]); UtrkaInfo[utrkaPocela] = 0; UtrkaBrojac = GetTickCount(); UpdateEvent(); SetTimer("UpdateEvent",990,true); TogglePlayerControllable(i, 1); SetPlayerRaceCheckpoint(i, 0, CPInfo[1][cpX], CPInfo[1][cpY], CPInfo[1][cpZ], CPInfo[2][cpX], CPInfo[2][cpY], CPInfo[2][cpZ], UtrkaInfo[CPRadius]); } } return 1; } forward SakriStart(); public SakriStart() { foreach(Player,i) { if(GetPVarInt(i, "Na_Utrci") == 1) { TextDrawHideForPlayer(i, TDEvent4[i]); } } return 1; } forward UpdateEvent(); public UpdateEvent() { foreach(Player,i) { if(GetPVarInt(i, "Na_Utrci") == 1) { new rTime[3]; new string[200]; new TimeStamp,TotalRaceTime; TimeStamp = GetTickCount(); TotalRaceTime = TimeStamp - UtrkaBrojac; ConvertTime(var, TotalRaceTime, rTime[0], rTime[1], rTime[2]); format(string, sizeof string, "%02d:%02d",rTime[0], rTime[1]); TextDrawSetString(TDEvent6[i], string); } } } public OnPlayerEnterRaceCheckpoint(playerid) { new rTime[3]; if(UtrkaInfo[utrkaUcitan] == 1) { if(GetPVarInt(playerid, "Na_Utrci") == 1) { if(UtrkaInfo[utrkaVozila] == 1) { if(!IsPlayerInAnyVehicle(playerid)) { KillTimer(EventTimer[playerid]); TextDrawHideForPlayer(playerid, TDEvent5[playerid]); TextDrawHideForPlayer(playerid, TDEvent6[playerid]); TextDrawHideForPlayer(playerid, TDEvent4[playerid]); TextDrawHideForPlayer(playerid, TDEvent3[playerid]); TextDrawHideForPlayer(playerid, TDEvent2[playerid]); TextDrawHideForPlayer(playerid, TDEvent1[playerid]); SetPVarInt(playerid, "Na_Utrci", 0); DisablePlayerRaceCheckpoint(playerid); SendClientMessage(playerid, COLOR_GLAVNA,"You have to be a driver! You're disqualified!"); return 1; } } if(IsPlayerInRangeOfPoint(playerid, UtrkaInfo[CPRadius], CPInfo[CPid[playerid]][cpX], CPInfo[CPid[playerid]][cpY], CPInfo[CPid[playerid]][cpZ])) { if(CPInfo[CPid[playerid]][utrkaProlaz] == 1) { UtrkaProlaz[playerid] = UtrkaProlaz[playerid]+1; new TimeStamp,TotalRaceTime; TimeStamp = GetTickCount(); TotalRaceTime = TimeStamp - UtrkaBrojac; ConvertTime(var, TotalRaceTime, rTime[0], rTime[1], rTime[2]); new str[128]; format(str,128,"-> | %s || Pass-%d(circle %d) || %s || Time: %02d:%02d",UtrkaInfo[utrkaIme], UtrkaProlaz[playerid],KrugProlaz[playerid], PlayerName(playerid), rTime[0], rTime[1]); UtrkaPoruka(COLOR_MEDIUMAQUA, str); } if(UtrkaInfo[utrkaZadnjiCP] == CPid[playerid]) { if(UtrkaInfo[utrkaZadnjiCP] == CPid[playerid]) { if(UtrkaInfo[utrkaKrugova] > 1) { if(KrugProlaz[playerid] != UtrkaInfo[utrkaKrugova]) { CPid[playerid] = 1; if(UtrkaInfo[utrkaZadnjiCP] == CPid[playerid]) { SetPlayerRaceCheckpoint(playerid, 1, CPInfo[CPid[playerid]][cpX], CPInfo[CPid[playerid]][cpY], CPInfo[CPid[playerid]][cpZ], CPInfo[CPid[playerid]+1][cpX], CPInfo[CPid[playerid]+1][cpY], CPInfo[CPid[playerid]+1][cpZ], UtrkaInfo[CPRadius]); } else { SetPlayerRaceCheckpoint(playerid, 0, CPInfo[CPid[playerid]][cpX], CPInfo[CPid[playerid]][cpY], CPInfo[CPid[playerid]][cpZ], CPInfo[CPid[playerid]+1][cpX], CPInfo[CPid[playerid]+1][cpY], CPInfo[CPid[playerid]+1][cpZ], UtrkaInfo[CPRadius]); } UtrkaProlaz[playerid] = 0; new TimeStamp,TotalRaceTime; TimeStamp = GetTickCount(); TotalRaceTime = TimeStamp - UtrkaBrojac; ConvertTime(var, TotalRaceTime, rTime[0], rTime[1], rTime[2]); new str[128]; format(str,128,"->O | %s || CIRCLE PASSAGE || %d/%d circles || %s | Time: %02d:%02d",UtrkaInfo[utrkaIme], KrugProlaz[playerid],UtrkaInfo[utrkaKrugova], PlayerName(playerid), rTime[0], rTime[1]); UtrkaPoruka(COLOR_MEDIUMAQUA, str); KrugProlaz[playerid] = KrugProlaz[playerid]+1; return 1; } } } DisablePlayerRaceCheckpoint(playerid); new TimeStamp,TotalRaceTime; TimeStamp = GetTickCount(); TotalRaceTime = TimeStamp - UtrkaBrojac; ConvertTime(var, TotalRaceTime, rTime[0], rTime[1], rTime[2]); RaceZavrsio++; new str[128]; format(str,128,"|| %s || FINISH! || %d.%s | Time: %02d:%02d",UtrkaInfo[utrkaIme], RaceZavrsio,PlayerName(playerid), rTime[0], rTime[1]); UtrkaPoruka(COLOR_LIGHTRED, str); if(RaceZavrsio == 1) { if(rTime[0] < UtrkaInfo[utrkaRekordMinuti]) { new file[64]; format(file,64,"/races/%s.RACE",UtrkaInfo[utrkaFileIme]); dini_Set(file, "Rekorder", PlayerName(playerid)); dini_IntSet(file, "RekordMinuti", rTime[0]); dini_IntSet(file, "RekordSekunde", rTime[1]); UtrkaInfo[utrkaRekordMinuti] = rTime[0]; UtrkaInfo[utrkaRekordSekunde] = rTime[1]; format(str,128,"TRACK RECORD BROKEN!!! Record broken by: [[%s]] Congratulations!", PlayerName(playerid)); UtrkaPoruka(COLOR_LIGHTRED, str); } else if(rTime[0] == UtrkaInfo[utrkaRekordMinuti]) { if(rTime[1]< UtrkaInfo[utrkaRekordSekunde]) { new file[64]; format(file,64,"/races/%s.RACE",UtrkaInfo[utrkaFileIme]); dini_Set(file, "Rekorder", PlayerName(playerid)); dini_IntSet(file, "RekordMinuti", rTime[0]); dini_IntSet(file, "RekordSekunde", rTime[1]); UtrkaInfo[utrkaRekordMinuti] = rTime[0]; UtrkaInfo[utrkaRekordSekunde] = rTime[1]; format(str,128,"TRACK RECORD BROKEN!!! Record broken by: [[%s]] Congratulations!", PlayerName(playerid)); UtrkaPoruka(COLOR_LIGHTRED, str); } } } TextDrawHideForPlayer(playerid, TDEvent5[playerid]); TextDrawHideForPlayer(playerid, TDEvent6[playerid]); TextDrawHideForPlayer(playerid, TDEvent4[playerid]); TextDrawHideForPlayer(playerid, TDEvent3[playerid]); TextDrawHideForPlayer(playerid, TDEvent2[playerid]); TextDrawHideForPlayer(playerid, TDEvent1[playerid]); KillTimer(EventTimer[playerid]); UtrkaProlaz[playerid] = 0; KrugProlaz[playerid]= 1; return 1; } CPid[playerid] = CPid[playerid]+1; if(UtrkaInfo[utrkaZadnjiCP] == CPid[playerid]) { if(KrugProlaz[playerid] != UtrkaInfo[utrkaKrugova]) { SetPlayerRaceCheckpoint(playerid, 0, CPInfo[CPid[playerid]][cpX], CPInfo[CPid[playerid]][cpY], CPInfo[CPid[playerid]][cpZ], CPInfo[CPid[playerid]+1][cpX], CPInfo[CPid[playerid]+1][cpY], CPInfo[CPid[playerid]+1][cpZ], UtrkaInfo[CPRadius]); } else { SetPlayerRaceCheckpoint(playerid, 1, CPInfo[CPid[playerid]][cpX], CPInfo[CPid[playerid]][cpY], CPInfo[CPid[playerid]][cpZ], CPInfo[CPid[playerid]+1][cpX], CPInfo[CPid[playerid]+1][cpY], CPInfo[CPid[playerid]+1][cpZ], UtrkaInfo[CPRadius]); } } else { SetPlayerRaceCheckpoint(playerid, 0, CPInfo[CPid[playerid]][cpX], CPInfo[CPid[playerid]][cpY], CPInfo[CPid[playerid]][cpZ], CPInfo[CPid[playerid]+1][cpX], CPInfo[CPid[playerid]+1][cpY], CPInfo[CPid[playerid]+1][cpZ], UtrkaInfo[CPRadius]); } return 1; } } } return 1; } /* CMD */ CMD:quitracing(playerid, params[]) { if(GetPVarInt(playerid, "Na_Utrci") == 1) { DisablePlayerRaceCheckpoint(playerid); KillTimer(EventTimer[playerid]); TextDrawHideForPlayer(playerid, TDEvent5[playerid]); TextDrawHideForPlayer(playerid, TDEvent6[playerid]); TextDrawHideForPlayer(playerid, TDEvent4[playerid]); TextDrawHideForPlayer(playerid, TDEvent3[playerid]); TextDrawHideForPlayer(playerid, TDEvent2[playerid]); TextDrawHideForPlayer(playerid, TDEvent1[playerid]); SetPVarInt(playerid, "Na_Utrci", 0); SendClientMessage(playerid, COLOR_YELLOW, "You successfully quit racing!"); } SetPVarInt(playerid, "RaceIzrada", 0); SetPVarInt(playerid, "Na_Utrci", 0); return 1; } CMD:ecreate(playerid,params[]) { if(GetPVarInt(playerid, "Admin") < 1) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } new idx,tmp[32]; new string[200]; tmp = strtok(params, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_EVENT,"Usage: /ecreate [vehicle id] [group: 1(1-16) - 2(17-32)]"); return 1; } new idvozila; idvozila = strval(tmp); if(idvozila < 400 || idvozila > 611) { SendClientMessage(playerid, COLOR_ERROR, " {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}Vehicle id can go from 400 to 607!"); return 1; } tmp = strtok(params, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_EVENT, "Usage: /ecreate [vehicle id] [group: 1(1-16) - 2(17-32)]"); return 1; } new grupa; grupa = strval(tmp); if(grupa > 2 || grupa < 1) { SendClientMessage(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}Wrong group!"); return 1; } if(grupa == 1)//grupa 1 { if (kreirano == 0) { Event1 = AddStaticVehicle(idvozila,1130.0621,2171.7693,16.4458,359.7352,0,16); // Event2 = AddStaticVehicle(idvozila,1126.6007,2171.7693,16.4458,359.0454,1,17); // Event3 = AddStaticVehicle(idvozila,1123.3440,2171.7693,16.4458,0.2249,2,18); // Event4 = AddStaticVehicle(idvozila,1119.9668,2171.7693,16.4458,359.9208,3,19); // Event5 = AddStaticVehicle(idvozila,1116.4963,2171.7693,16.4458,0.0194,4,20); // Event6 = AddStaticVehicle(idvozila,1113.1903,2171.7693,16.4458,359.4152,5,21); // Event7 = AddStaticVehicle(idvozila,1109.8062,2171.7693,16.4458,359.6416,6,22); // Event8 = AddStaticVehicle(idvozila,1106.3829,2171.7693,16.4458,0.8217,7,23); // Event9 = AddStaticVehicle(idvozila,1103.0778,2171.7693,16.4458,359.4910,8,24); // Event10 = AddStaticVehicle(idvozila,1099.6969,2171.7693,16.4458,359.5809,9,25); // Event11 = AddStaticVehicle(idvozila,1096.3632,2171.7693,16.4458,359.2728,10,26); // Event12 = AddStaticVehicle(idvozila,1092.9690,2171.7693,16.4458,359.0023,11,27); // Event13 = AddStaticVehicle(idvozila,1089.5120,2171.7693,16.4458,359.7700,12,28); // Event14 = AddStaticVehicle(idvozila,1086.1775,2171.7693,16.4458,359.9055,13,29); // Event15 = AddStaticVehicle(idvozila,1082.6877,2171.7693,16.4458,359.0917,14,30); // Event16 = AddStaticVehicle(idvozila,1133.4928,2171.7693,16.4458,359.3750,15,31); // kreirano = 1; format(string, 256, "*Admin %s, created vehicle: %d in group: 1",PlayerName(playerid),idvozila); SendAdminMessage(COLOR_YELLOW, string); } else { SendClientMessage(playerid, COLOR_ERROR, " {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}That group is already created!"); } } else//grupa 2 { if (kreirano2 == 0) { Event21 = AddStaticVehicle(idvozila,1130.0621,2183.8350,16.4458,359.7352,32,48); // Event22 = AddStaticVehicle(idvozila,1126.6007,2183.8350,16.4458,359.0454,33,49); // Event23 = AddStaticVehicle(idvozila,1123.3440,2183.8350,16.4458,0.2249,34,50); // Event24 = AddStaticVehicle(idvozila,1119.9668,2183.8350,16.4458,359.9208,35,51); // Event25 = AddStaticVehicle(idvozila,1116.4963,2183.8350,16.4458,0.0194,36,52); // Event26 = AddStaticVehicle(idvozila,1113.1903,2183.8350,16.4458,359.4152,37,53); // Event27 = AddStaticVehicle(idvozila,1109.8062,2183.8350,16.4458,359.6416,38,54); // Event28 = AddStaticVehicle(idvozila,1106.3829,2183.8350,16.4458,0.8217,39,55); // Event29 = AddStaticVehicle(idvozila,1103.0778,2183.8350,16.4458,359.4910,40,56); // Event210 = AddStaticVehicle(idvozila,1099.6969,2183.8350,16.4458,359.5809,41,57); // Event211 = AddStaticVehicle(idvozila,1096.3632,2183.8350,16.4458,359.2728,42,58); // Event212 = AddStaticVehicle(idvozila,1092.9690,2183.8350,16.4458,359.0023,43,59); // Event213 = AddStaticVehicle(idvozila,1089.5120,2183.8350,16.4458,359.7700,44,60); // Event214 = AddStaticVehicle(idvozila,1086.1775,2183.8350,16.4458,359.9055,45,61); // Event215 = AddStaticVehicle(idvozila,1082.6877,2183.8350,16.4458,359.0917,46,62); // Event216 = AddStaticVehicle(idvozila,1133.4928,2183.8350,16.4458,359.3750,47,63); // kreirano2 = 1; format(string, 256, "*Admin %s, created vehicle: %d in group: 2",PlayerName(playerid),idvozila); SendAdminMessage(COLOR_YELLOW, string); } else { SendClientMessage(playerid, COLOR_ERROR, " {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}That group is already created!"); } } return 1; } CMD:edestroy(playerid,params[]) { if(GetPVarInt(playerid, "Admin") < 1) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } new idx,tmp[32]; new string[200]; tmp = strtok(params, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COL_CHADM,"Usage: /edestroy [group: 1(1-16) - 2(17-32)]"); return 1; } new grupa = strval(tmp); if(grupa > 2 || grupa < 1) { SendClientMessage(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}Wrong group!"); return 1; } if(grupa == 1)//grupa 1 { if (kreirano == 1) { DestroyVehicle(Event1); DestroyVehicle(Event2); DestroyVehicle(Event3); DestroyVehicle(Event4); DestroyVehicle(Event5); DestroyVehicle(Event6); DestroyVehicle(Event7); DestroyVehicle(Event8); DestroyVehicle(Event9); DestroyVehicle(Event10); DestroyVehicle(Event11); DestroyVehicle(Event12); DestroyVehicle(Event13); DestroyVehicle(Event14); DestroyVehicle(Event15); DestroyVehicle(Event16); kreirano = 0; format(string, 256, "*Admin %s, destroyed group: 1 event vehicles",PlayerName(playerid)); SendAdminMessage(COLOR_YELLOW, string); } else { SendClientMessage(playerid, COLOR_ERROR, " {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}That group isn't created!"); } } else//grupa 2 { if (kreirano2 == 1) { DestroyVehicle(Event21); DestroyVehicle(Event22); DestroyVehicle(Event23); DestroyVehicle(Event24); DestroyVehicle(Event25); DestroyVehicle(Event26); DestroyVehicle(Event27); DestroyVehicle(Event28); DestroyVehicle(Event29); DestroyVehicle(Event210); DestroyVehicle(Event211); DestroyVehicle(Event212); DestroyVehicle(Event213); DestroyVehicle(Event214); DestroyVehicle(Event215); DestroyVehicle(Event216); kreirano2 = 0; format(string, 256, "*Admin %s, destroyed group: 2 event vehicles",PlayerName(playerid)); SendAdminMessage(COLOR_YELLOW, string); } else { SendClientMessage(playerid, COLOR_ERROR, " {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}That group isn't created!"); } } return 1; } CMD:eport(playerid,params[]) { if(GetPVarInt(playerid, "Admin") < 1) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } new idx,tmp[32]; new string[200]; tmp = strtok(params, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COL_CHADM,"Usage: /eport [kind of orientation 1 - ||, 2 - ==] [group 1 or 2]"); SendClientMessage(playerid, COLOR_YELLOW,"Kind of orientation: 1 - North-South, 2 - East-West"); SendClientMessage(playerid, COLOR_BISQUE,"Group: 1 or 2(in each 16 vehicles)"); return 1; } new orjentacija; new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z); new Float:plocx,Float:plocy,Float:plocz; GetPlayerPos(playerid, plocx, plocy, plocz); orjentacija = strval(tmp); if(orjentacija < 1 || orjentacija > 2) { SendClientMessage(playerid, COLOR_ERROR, " {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}Kriva orjentacija 1 - ||, 2 - =="); return 1; } tmp = strtok(params, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COL_CHADM,"Usage: /eport [kind of orientation 1 - ||, 2 - ==] [group 1 or 2]"); SendClientMessage(playerid, COLOR_YELLOW,"Kind of orientation: 1 - North-South, 2 - East-West"); SendClientMessage(playerid, COLOR_BISQUE,"Group: 1 or 2(in each 16 vehicles)"); return 1; } new grupa = strval(tmp); if(grupa > 2 || grupa < 1) { SendClientMessage(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}Wrong group!"); return 1; } if(grupa == 1)//grupa 1 { if (kreirano == 1) { if(orjentacija == 1)//orjentacija 1 { SetVehicleToRespawn(Event1); SetVehicleToRespawn(Event2); SetVehicleToRespawn(Event3); SetVehicleToRespawn(Event4); SetVehicleToRespawn(Event5); SetVehicleToRespawn(Event6); SetVehicleToRespawn(Event7); SetVehicleToRespawn(Event8); SetVehicleToRespawn(Event9); SetVehicleToRespawn(Event10); SetVehicleToRespawn(Event11); SetVehicleToRespawn(Event12); SetVehicleToRespawn(Event13); SetVehicleToRespawn(Event14); SetVehicleToRespawn(Event15); SetVehicleToRespawn(Event16); SetVehiclePos(Event1,plocx+2,plocy+9, plocz); SetVehiclePos(Event2,plocx-2,plocy+9, plocz); SetVehiclePos(Event3,plocx+2,plocy+3, plocz); SetVehiclePos(Event4,plocx-2,plocy+3, plocz); SetVehiclePos(Event5,plocx+2,plocy-3, plocz); SetVehiclePos(Event6,plocx-2,plocy-3, plocz); SetVehiclePos(Event7,plocx+2,plocy-9, plocz); SetVehiclePos(Event8,plocx-2,plocy-9, plocz); SetVehiclePos(Event9,plocx+2,plocy+21, plocz); SetVehiclePos(Event10,plocx-2,plocy+15, plocz); SetVehiclePos(Event11,plocx+2,plocy+15, plocz); SetVehiclePos(Event12,plocx-2,plocy+21, plocz); SetVehiclePos(Event13,plocx+2,plocy-21, plocz); SetVehiclePos(Event14,plocx-2,plocy-21, plocz); SetVehiclePos(Event15,plocx+2,plocy-15, plocz); SetVehiclePos(Event16,plocx-2,plocy-15, plocz); } if(orjentacija == 2)//orjentacija 2 { SetVehicleToRespawn(Event1); SetVehicleToRespawn(Event2); SetVehicleToRespawn(Event3); SetVehicleToRespawn(Event4); SetVehicleToRespawn(Event5); SetVehicleToRespawn(Event6); SetVehicleToRespawn(Event7); SetVehicleToRespawn(Event8); SetVehicleToRespawn(Event9); SetVehicleToRespawn(Event10); SetVehicleToRespawn(Event11); SetVehicleToRespawn(Event12); SetVehicleToRespawn(Event13); SetVehicleToRespawn(Event14); SetVehicleToRespawn(Event15); SetVehicleToRespawn(Event16); SetVehiclePos(Event1,plocx+2,plocy+9, plocz); SetVehiclePos(Event2,plocx+6,plocy+9, plocz); SetVehiclePos(Event3,plocx+10,plocy+9, plocz); SetVehiclePos(Event4,plocx+14,plocy+9, plocz); SetVehiclePos(Event5,plocx-2,plocy+9, plocz); SetVehiclePos(Event6,plocx-6,plocy+9, plocz); SetVehiclePos(Event7,plocx-10,plocy+9, plocz); SetVehiclePos(Event8,plocx-14,plocy+9, plocz); SetVehiclePos(Event9,plocx+2,plocy+3, plocz); SetVehiclePos(Event10,plocx+6,plocy+3, plocz); SetVehiclePos(Event11,plocx+10,plocy+3, plocz); SetVehiclePos(Event12,plocx+14,plocy+3, plocz); SetVehiclePos(Event13,plocx-2,plocy+3, plocz); SetVehiclePos(Event14,plocx-6,plocy+3, plocz); SetVehiclePos(Event15,plocx-10,plocy+3, plocz); SetVehiclePos(Event16,plocx-14,plocy+3, plocz); } format(string, 256, "*Admin %s, ported vehicles(1)to himself, orientation: %d",PlayerName(playerid),orjentacija); SendAdminMessage(COLOR_YELLOW, string); } else { SendClientMessage(playerid, COLOR_ERROR, " {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}That group isn't created!"); } } else//grupa 2 { if (kreirano2 == 1) { if(orjentacija == 1)//orjentacija 1 { SetVehicleToRespawn(Event21); SetVehicleToRespawn(Event22); SetVehicleToRespawn(Event23); SetVehicleToRespawn(Event24); SetVehicleToRespawn(Event25); SetVehicleToRespawn(Event26); SetVehicleToRespawn(Event27); SetVehicleToRespawn(Event28); SetVehicleToRespawn(Event29); SetVehicleToRespawn(Event210); SetVehicleToRespawn(Event211); SetVehicleToRespawn(Event212); SetVehicleToRespawn(Event213); SetVehicleToRespawn(Event214); SetVehicleToRespawn(Event215); SetVehicleToRespawn(Event216); SetVehiclePos(Event21,plocx+2,plocy+9, plocz); SetVehiclePos(Event22,plocx-2,plocy+9, plocz); SetVehiclePos(Event23,plocx+2,plocy+3, plocz); SetVehiclePos(Event24,plocx-2,plocy+3, plocz); SetVehiclePos(Event25,plocx+2,plocy-3, plocz); SetVehiclePos(Event26,plocx-2,plocy-3, plocz); SetVehiclePos(Event27,plocx+2,plocy-9, plocz); SetVehiclePos(Event28,plocx-2,plocy-9, plocz); SetVehiclePos(Event29,plocx+2,plocy+21, plocz); SetVehiclePos(Event210,plocx-2,plocy+15, plocz); SetVehiclePos(Event211,plocx+2,plocy+15, plocz); SetVehiclePos(Event212,plocx-2,plocy+21, plocz); SetVehiclePos(Event213,plocx+2,plocy-21, plocz); SetVehiclePos(Event214,plocx-2,plocy-21, plocz); SetVehiclePos(Event215,plocx+2,plocy-15, plocz); SetVehiclePos(Event216,plocx-2,plocy-15, plocz); } if(orjentacija == 2)//orjentacija 2 { SetVehicleToRespawn(Event21); SetVehicleToRespawn(Event22); SetVehicleToRespawn(Event23); SetVehicleToRespawn(Event24); SetVehicleToRespawn(Event25); SetVehicleToRespawn(Event26); SetVehicleToRespawn(Event27); SetVehicleToRespawn(Event28); SetVehicleToRespawn(Event29); SetVehicleToRespawn(Event210); SetVehicleToRespawn(Event211); SetVehicleToRespawn(Event212); SetVehicleToRespawn(Event213); SetVehicleToRespawn(Event214); SetVehicleToRespawn(Event215); SetVehicleToRespawn(Event216); SetVehiclePos(Event21,plocx+2,plocy+9, plocz); SetVehiclePos(Event22,plocx+6,plocy+9, plocz); SetVehiclePos(Event23,plocx+10,plocy+9, plocz); SetVehiclePos(Event24,plocx+14,plocy+9, plocz); SetVehiclePos(Event25,plocx-2,plocy+9, plocz); SetVehiclePos(Event26,plocx-6,plocy+9, plocz); SetVehiclePos(Event27,plocx-10,plocy+9, plocz); SetVehiclePos(Event28,plocx-14,plocy+9, plocz); SetVehiclePos(Event29,plocx+2,plocy+3, plocz); SetVehiclePos(Event210,plocx+6,plocy+3, plocz); SetVehiclePos(Event211,plocx+10,plocy+3, plocz); SetVehiclePos(Event212,plocx+14,plocy+3, plocz); SetVehiclePos(Event213,plocx-2,plocy+3, plocz); SetVehiclePos(Event214,plocx-6,plocy+3, plocz); SetVehiclePos(Event215,plocx-10,plocy+3, plocz); SetVehiclePos(Event216,plocx-14,plocy+3, plocz); } format(string, 256, "*Admin %s, ported vehicles(2)to himself, orientation: %d",PlayerName(playerid),orjentacija); SendAdminMessage(COLOR_YELLOW, string); } else { SendClientMessage(playerid, COLOR_ERROR, " {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}That group isn't created!"); } } return 1; } CMD:racecreationpermit(playerid, params[]) { if(GetPVarInt(playerid, "Admin") < 1338) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } new string[256], id; if(sscanf(params,"u", id)) return SCM(playerid, COLOR_GRAD, "Usage: /racecreationpermit [User ID or User Name]"); foreach(Player, i) { if(GetPVarInt(i, "RaceIzrada") == 1) { SCM(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Rejected!{FFFFFF}] {C3C3C3}The race is currently under construction!"); return 1; } } if(UtrkaInfo[utrkaUcitan] == 1) return SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}Race is loaded! You can not make a race while race is loaded!"); id = ReturnUser(params); if(!IsPlayerConnected(id)) { SendClientMessage(playerid, COLOR_ERROR, "*Invalid User ID"); return 1; } SetPVarInt(id, "RaceIzrada", 1); format(string, sizeof(string), " Race creation | Admin %s gave you the authority to create a race!", PlayerName(playerid)); SendClientMessage(id,COLOR_YELLOW, string); format(string, sizeof(string), " Race creation | You gave authority %s to create a race!", PlayerName(id)); SendClientMessage(playerid,COLOR_YELLOW, string); strmid(ImeUtrke,"Default!", 0,strlen("Default!"), 255); return 1; } CMD:racename(playerid, params[]) { if(GetPVarInt(playerid, "RaceIzrada") == 0) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}REJECTED!"); return 1; } new idx; new length = strlen(params); while ((idx < length) && (params[idx] <= ' ')) { idx++; } new offset = idx; new result[164]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = params[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD, "Usage: /racename [Race title]"); return 1; } if(strlen(result) < 3) return SCM(playerid, COLOR_YELLOW, "*To short race title!"); else if(strlen(result) > 30) return SCM(playerid, COLOR_YELLOW, "*To long race title!"); strmid(ImeUtrke,result, 0, strlen(result), 255); SCMF(playerid, COLOR_YELLOW, " Race Title: %s", ImeUtrke); return 1; } CMD:racecp(playerid, params[]) { if(GetPVarInt(playerid, "RaceIzrada") == 1) { new Float:X, Float:Y, Float:Z; new utrkaFile[256]; new string[256], zadnjicp, Float:radius, prolaz, idcpa; if(sscanf(params,"ifii",zadnjicp, radius, prolaz, idcpa)) return SCM(playerid, COLOR_GRAD,"Usage: /racecp [last CP? 1-YES, 0-No] [CP radius] [PASS? 1-YES, 0-No] [CP ID]"); if(zadnjicp > 1) return SCM(playerid, 0xadaeadFF," Last CP wrong amount! 1-YES, 0-NO!"); if(prolaz > 1) return SCM(playerid, 0xadaeadFF," Pass wrong amount! 1-YES, 0-NO!"); if(zadnjicp < 0) return SCM(playerid, 0xadaeadFF," Last CP wrong amount! 1-YES, 0-NO!"); if(prolaz < 0) return SCM(playerid, 0xadaeadFF," Pass wrong amount! 1-YES, 0-NO!"); if(idcpa > 50) return SCM(playerid, 0xadaeadFF," CP Wrong id!"); if(radius > 20) return SCM(playerid, 0xadaeadFF," Wrong radius! Span: from 5.0 to 20.0"); if(radius < 5) return SCM(playerid, 0xadaeadFF," Wrong radius! Span: from 5.0 to 20.0"); format(utrkaFile, sizeof(utrkaFile), "/races/%s.RACE", "Default!"); dini_Create(utrkaFile); if(IsPlayerInAnyVehicle(playerid)) { GetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z); format(string, sizeof(string), "CP_%d_PosX", idcpa), dini_FloatSet(utrkaFile, string, X); format(string, sizeof(string), "CP_%d_PosY", idcpa), dini_FloatSet(utrkaFile, string, Y); format(string, sizeof(string), "CP_%d_PosZ", idcpa), dini_FloatSet(utrkaFile, string, Z); format(string, sizeof(string), "CP_%d_Prolaz", idcpa), dini_IntSet(utrkaFile, string, prolaz); //dini_IntSet(rFile, "CP_%d_Prolaz",idcpa, idcpa); if(zadnjicp == 1) { dini_IntSet(utrkaFile, "Zadnji_CP", idcpa); } dini_FloatSet(utrkaFile, "CP_Radius", radius); } else { GetPlayerPos(playerid, X, Y, Z); format(string, sizeof(string), "CP_%d_PosX", idcpa), dini_FloatSet(utrkaFile, string, X); format(string, sizeof(string), "CP_%d_PosY", idcpa), dini_FloatSet(utrkaFile, string, Y); format(string, sizeof(string), "CP_%d_PosZ", idcpa), dini_FloatSet(utrkaFile, string, Z); format(string, sizeof(string), "CP_%d_Prolaz", idcpa), dini_IntSet(utrkaFile, string, prolaz); //dini_IntSet(utrkaFile, "CP_%d_Prolaz",idcpa, idcpa); if(zadnjicp == 1) { dini_IntSet(utrkaFile, "Zadnji_CP", idcpa); } dini_FloatSet(utrkaFile, "CP_Radius", radius); } dini_Set(utrkaFile,"Rekorder", "None"); dini_IntSet(utrkaFile, "RekordMinuti", 59); dini_IntSet(utrkaFile, "RekordSekunde", 59); dini_IntSet(utrkaFile, "BrojCP", idcpa); format(string, sizeof(string)," CP[%s] CPid[%d] X[%.4f] Y[%.4f] Z[%.4f] R[%.2f] LAS?[%d] PAS?[%d]", PlayerName(playerid), idcpa, X, Y, Z, radius, zadnjicp, prolaz); SendAdminMessage(COLOR_YELLOW, string); } else return SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}REJECTED!"); return 1; } CMD:saverace(playerid, params[]) { if(GetPVarInt(playerid, "RaceIzrada") == 1) { new string[256]; new kod, naziv[12], krugova, vozila; if(sscanf(params,"is[10]ii", kod, naziv, krugova, vozila)) return SCM(playerid, COLOR_GRAD,"Usage: /saverace [security code?] [fileName] [circles] [Vehicles? 1-yes 0-no]"); if(kod != 2011001){ return 1; } if(strlen(naziv) < 3) return SCM(playerid, COLOR_YELLOW, "*To short file title!"); if(strlen(naziv) > 30) return SCM(playerid, COLOR_YELLOW, "*To long file title!"); if(krugova > 100) return SCM(playerid,0xadaeadFF," circles??!! 0, <=100!"); if(krugova < 0) return SCM(playerid,0xadaeadFF," circles??!! 0, <=100!"); if(vozila > 1) return SCM(playerid, 0xadaeadFF," Vehicles??!! 1-YES, 0-NO!"); if(vozila < 0) return SCM(playerid, 0xadaeadFF," Vehicles??!! 1-YES, 0-NO!"); // ---- Default!.RACE File !!!!!! // new file1[128]; format(file1, 128, "/races/%s.RACE", "Default!"); if(fexist(file1)) { format(UtrkaInfo[utrkaIme], sizeof(UtrkaInfo[utrkaIme]), "%s", dini_Get(file1, "Ime_Utrke")); UtrkaInfo[utrkaBrojCP] = dini_Int(file1, "BrojCP"); format(UtrkaInfo[utrkaRekorder], sizeof(UtrkaInfo[utrkaRekorder]), "%s", dini_Get(file1, "Rekorder")); UtrkaInfo[utrkaRekordMinuti] = dini_Int(file1, "RekordMinuti"); UtrkaInfo[utrkaRekordSekunde] = dini_Int(file1, "RekordSekunde"); for(new cp = 1; cp < MAX_CP; cp++) { new cpid[64]; format(cpid,64,"CP_%d_PosX", cp); CPInfo[cp][cpX] = dini_Float(file1, cpid); format(cpid,64,"CP_%d_PosY", cp); CPInfo[cp][cpY] = dini_Float(file1, cpid); format(cpid,64,"CP_%d_PosZ", cp); CPInfo[cp][cpZ] = dini_Float(file1, cpid); format(cpid,64,"CP_%d_Prolaz", cp); CPInfo[cp][utrkaProlaz] = dini_Int(file1, cpid); } UtrkaInfo[utrkaZadnjiCP] = dini_Int(file1, "Zadnji_CP"); UtrkaInfo[CPRadius] = dini_Float(file1, "CP_Radius"); } // ------- Saving Race !---------// new utrkaf[128]; format(utrkaf, sizeof(utrkaf),"/races/%s.RACE", naziv); UtrkaInfo[utrkaRekordMinuti] = 59; UtrkaInfo[utrkaRekordSekunde] = 59; dini_Create(utrkaf); dini_Set(utrkaf, "Ime_Utrke", ImeUtrke); dini_IntSet(utrkaf,"BrojCP", UtrkaInfo[utrkaBrojCP]); dini_Set(utrkaf, "Rekorder", "None"); dini_IntSet(utrkaf,"RekordMinuti", UtrkaInfo[utrkaRekordMinuti]); dini_IntSet(utrkaf,"RekordSekunde", UtrkaInfo[utrkaRekordSekunde]); dini_IntSet(utrkaf,"Krugova", krugova); dini_IntSet(utrkaf,"Vozila", vozila); for(new cp = 1; cp < UtrkaInfo[utrkaBrojCP]+1; cp++) { new cpid[124]; format(cpid,64,"CP_%d_PosX", cp); dini_FloatSet(utrkaf, cpid, CPInfo[cp][cpX]); format(cpid,64,"CP_%d_PosY", cp); dini_FloatSet(utrkaf, cpid, CPInfo[cp][cpY]); format(cpid,64,"CP_%d_PosZ", cp); dini_FloatSet(utrkaf, cpid, CPInfo[cp][cpZ]); format(cpid,64,"CP_%d_Prolaz", cp); dini_IntSet(utrkaf, cpid, CPInfo[cp][utrkaProlaz]); } dini_IntSet(utrkaf,"Zadnji_CP", UtrkaInfo[utrkaZadnjiCP]); dini_FloatSet(utrkaf, "CP_Radius", UtrkaInfo[CPRadius]); dini_Remove(file1); format(string, sizeof(string), " [Race created!]File name: %s, circles: %d, Vehicles: %d", naziv, krugova, vozila); SCM(playerid, COLOR_YELLOW, string); SetPVarInt(playerid, "RaceIzrada", 0); } else return SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}REJECTED!"); return 1; } CMD:loadrace(playerid, params[]) { if(GetPVarInt(playerid, "Admin") < 1) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } foreach(Player, i) { if(GetPVarInt(i, "RaceIzrada") == 1) { SCM(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Rejected!{FFFFFF}] {C3C3C3}The race is currently under construction!"); return 1; } } new string[256]; new utrka[14]; if(UtrkaInfo[utrkaUcitan] == 1) return SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}The race is already loaded! /unloadrace to unload a race!"); if(sscanf(params,"s[14]", utrka)) return SendClientMessage(playerid, COLOR_GRAD, "Usage: /loadrace [file name! {F81414}Warning: Do not try randomly named files!]"); if(strlen(params) < 3){SCM(playerid,COLOR_YELLOW,"*Error");return 1;} if(strlen(params) > 30){SCM(playerid,COLOR_YELLOW,"*Error");return 1;} new file[128]; format(file, 128, "/races/%s.RACE", utrka); if(fexist(file)) { format(UtrkaInfo[utrkaFileIme], sizeof(UtrkaInfo[utrkaFileIme]), "%s", utrka); UtrkaInfo[utrkaUcitan] = 1; UtrkaInfo[utrkaPocela] = 0; format(UtrkaInfo[utrkaIme], sizeof(UtrkaInfo[utrkaIme]), "%s", dini_Get(file, "Ime_Utrke")); UtrkaInfo[utrkaBrojCP] = dini_Int(file, "BrojCP"); format(UtrkaInfo[utrkaRekorder], sizeof(UtrkaInfo[utrkaRekorder]), "%s", dini_Get(file, "Rekorder")); UtrkaInfo[utrkaRekordMinuti] = dini_Int(file, "RekordMinuti"); UtrkaInfo[utrkaRekordSekunde] = dini_Int(file, "RekordSekunde"); UtrkaInfo[utrkaKrugova] = dini_Int(file, "Krugova"); UtrkaInfo[utrkaVozila] = dini_Int(file, "Vozila"); for(new cp = 0; cp < UtrkaInfo[utrkaBrojCP]+1; cp++) { new cpid[64]; format(cpid,64,"CP_%d_PosX", cp); CPInfo[cp][cpX] = dini_Float(file, cpid); format(cpid,64,"CP_%d_PosY", cp); CPInfo[cp][cpY] = dini_Float(file, cpid); format(cpid,64,"CP_%d_PosZ", cp); CPInfo[cp][cpZ] = dini_Float(file, cpid); format(cpid,64,"CP_%d_Prolaz", cp); CPInfo[cp][utrkaProlaz] = dini_Int(file, cpid); } UtrkaInfo[CPRadius] = dini_Float(file, "CP_Radius"); UtrkaInfo[utrkaZadnjiCP] = dini_Int(file, "Zadnji_CP"); format(string, sizeof(string), "***[Loading race] %s | %s",PlayerName(playerid),utrka); SendAdminMessage(COLOR_EVENT,string); SendAdminMessage(COLOR_EVENT, "{00C0FF}---> {6EF83C}Ini file Successfully loaded!"); SendAdminMessage(COLOR_EVENT, "{00C0FF}---> {6EF83C}CFG file Successfully loaded!"); SendAdminMessage(COLOR_EVENT, "{00C0FF}(: {F3FF02}Race is successfully loaded!"); } else { format(string, sizeof(string), "***[Loading race] %s | %s",PlayerName(playerid),utrka); SendAdminMessage(COLOR_EVENT,string); SendAdminMessage(COLOR_GLAVNA, "---> Ini file DOES NOT EXIST!"); SendAdminMessage(COLOR_GLAVNA, "---> CFG file DOES NOT EXIST!"); SendAdminMessage(COLOR_GLAVNA, "Loading race failed!"); } return 1; } CMD:unloadrace(playerid, params[]) { if(GetPVarInt(playerid, "Admin") < 1) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } if(UtrkaInfo[utrkaUcitan] == 0) return SCM(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}The race is not loaded! /loadrace to load a race!"); UtrkaInfo[utrkaPocela] = 0; UtrkaInfo[utrkaUcitan] = 0; new str[128]; RaceZavrsio = 0; format(str, 128, "***[UNLOAD race] %s",PlayerName(playerid)); SendAdminMessage(COLOR_YELLOW, str); foreach(Player, i) { if(GetPVarInt(i, "Na_Utrci") == 1) { DisablePlayerRaceCheckpoint(i); TextDrawHideForPlayer(i, TDEvent5[i]); TextDrawHideForPlayer(i, TDEvent6[i]); TextDrawHideForPlayer(i, TDEvent4[i]); TextDrawHideForPlayer(i, TDEvent3[i]); TextDrawHideForPlayer(i, TDEvent2[i]); TextDrawHideForPlayer(i, TDEvent1[i]); UtrkaInfo[utrkaPocela] = 0; UtrkaInfo[utrkaUcitan] = 0; KillTimer(EventTimer[i]); UtrkaProlaz[i] = 0; KrugProlaz[i]= 1; SetPVarInt(i,"Na_Utrci", 0); } } return 1; } CMD:raceinvite(playerid, params[]) { new string[256]; if(GetPVarInt(playerid, "Admin") < 1) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } if(isnull(params)) return SendClientMessage(playerid, COLOR_GRAD,"Usage: /raceinvite [User ID or User Name]"); if(UtrkaInfo[utrkaUcitan] == 0) return SCM(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}The race is not loaded! /loadrace to load a race!"); foreach(Player, i) { if(GetPVarInt(i, "RaceIzrada") == 1) { SCM(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Rejected!{FFFFFF}] {C3C3C3}The race is currently under construction!"); return 1; } } new giveplayerid = ReturnUser(params); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { SetPVarInt(giveplayerid, "Na_Utrci", 1); format(string, sizeof(string), " %s | You're invited to %s race by admin %s", UtrkaInfo[utrkaIme],UtrkaInfo[utrkaIme],PlayerName(playerid)); SendClientMessage(giveplayerid,COLOR_EVENT, string); format(string, sizeof(string), " %s | You invited %s to %s race", UtrkaInfo[utrkaIme],PlayerName(giveplayerid),UtrkaInfo[utrkaIme]); SendClientMessage(playerid,COLOR_EVENT, string); } } else { SendClientMessage(playerid, COLOR_ERROR, "*Invalid User ID"); } return 1; } CMD:startrace(playerid, params[]) { if(GetPVarInt(playerid, "Admin") < 1) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } new string[256]; foreach(Player, i) { if(GetPVarInt(i, "RaceIzrada") == 1) { SCM(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Rejected!{FFFFFF}] {C3C3C3}Utrka je trenutno u izradi!"); return 1; } } if(UtrkaInfo[utrkaPocela] == 1) return SCM(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Rejected!{FFFFFF}] {C3C3C3}The race already started!"); if(UtrkaInfo[utrkaUcitan] == 0) return SCM(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}The race is not loaded! /loadrace to load a race!"); format(string, sizeof(string), "*You activated the Race", UtrkaInfo[utrkaIme]); SendClientMessage(playerid, COLOR_LIGHTRED, string); format(string, sizeof(string), "*Admin/gs %s activated | %s |", PlayerName(playerid),UtrkaInfo[utrkaIme]); SendAdminMessage(COLOR_LIGHTRED, string); foreach(Player,i) { if(GetPVarInt(i, "Na_Utrci") == 1) { UtrkaInfo[utrkaPocela] = 1; TogglePlayerControllable(playerid, 0); format(string, sizeof(string), "|Race: %s| Start for 3 seconds", UtrkaInfo[utrkaIme]); SendClientMessage(i, COLOR_SPRINGGREEN, string); format(string, sizeof(string),"Name of race: %s, circles:[%d], With vehicles(1-Yes):[%d] Record: [%d min] [%d sec] [%s ]", UtrkaInfo[utrkaIme], UtrkaInfo[utrkaKrugova], UtrkaInfo[utrkaVozila], UtrkaInfo[utrkaRekordMinuti], UtrkaInfo[utrkaRekordSekunde], UtrkaInfo[utrkaRekorder]); SendClientMessage(i, 0xFFFFFFAA, string); TextDrawShowForPlayer(i, TDEvent1[i]); TogglePlayerControllable(i, 0); SetTimer("eTimer3",Sec(1),0); TextDrawSetString(TDEvent6[i], "00:00"); if(UtrkaInfo[utrkaVozila] == 0) { SetPlayerSkin(i, 60); } } } return 1; } CMD:race(playerid, params[]) { if(GetPVarInt(playerid, "Admin") < 1) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } if(UtrkaInfo[utrkaUcitan] == 0) { SCM(playerid,COLOR_LIGHTBLUE,"________________ Utrka panel informacije __________________________________"); SCM(playerid,COLOR_LIGHTBLUE,"[0][Race is not loaded!], circles:[0], With vehicles(1-Yes):[0] Record: [59 min] [59 sec] [None]"); } if(UtrkaInfo[utrkaUcitan] == 1) { SCM(playerid,COLOR_LIGHTBLUE,"________________ Utrka panel informacije __________________________________"); SCMF(playerid,COLOR_LIGHTBLUE,"[1][%s], circles:[%d], With vehicles(1-Yes):[%d] Record: [%d min] [%d sec] [%s ]",UtrkaInfo[utrkaIme], UtrkaInfo[utrkaKrugova], UtrkaInfo[utrkaVozila], UtrkaInfo[utrkaRekordMinuti], UtrkaInfo[utrkaRekordSekunde], UtrkaInfo[utrkaRekorder]); } return 1; } CMD:raceport(playerid, params[]) { if(GetPVarInt(playerid, "Admin") < 1) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } if(UtrkaInfo[utrkaUcitan] == 0) return SCM(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}The race is not loaded! /loadrace to load a race!"); SCM(playerid,COLOR_LIGHTBLUE,"[RACE SYSTEM] Teleported you to the location of the first CP"); SetPlayerPos(playerid,CPInfo[1][cpX], CPInfo[1][cpY], CPInfo[1][cpZ]); return 1; } CMD:seestart(playerid, params[]) { if(GetPVarInt(playerid, "Admin") < 1) { SendClientMessage(playerid, 0xC3C3C3FF, " {FFFFFF}[{F81414}Ludi Grad{FFFFFF}] {C3C3C3}Admins only!"); return 1; } if(UtrkaInfo[utrkaUcitan] == 0) return SCM(playerid, COLOR_ERROR," {FFFFFF}[{F81414}Error!{FFFFFF}] {C3C3C3}The race is not loaded! /loadrace to load a race!"); SCM(playerid,COLOR_LIGHTBLUE,"[RACE SYSTEM] Location of the first CP set"); SetPlayerRaceCheckpoint(playerid, 0, CPInfo[1][cpX], CPInfo[1][cpY], CPInfo[1][cpZ], CPInfo[1][cpX], CPInfo[1][cpY], CPInfo[1][cpZ], UtrkaInfo[CPRadius]); return 1; } /* Stock */ stock UtrkaPoruka(color, str[]) { foreach(Player,i) { if(GetPVarInt(i, "Na_Utrci") > 0) { SCM(i, color, str); } } return 1; } stock PlayerName(playerid) { new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); return pName; } stock SCMF(playerid,color,fstring[],{Float, _}:...) { new n=(numargs()-3)*4; if(n) { new message[128],arg_start,arg_end; #emit CONST.alt fstring #emit LCTRL 5 #emit ADD #emit STOR.S.pri arg_start #emit LOAD.S.alt n #emit ADD #emit STOR.S.pri arg_end do { #emit LOAD.I #emit PUSH.pri arg_end-=4; #emit LOAD.S.pri arg_end } while(arg_end>arg_start); #emit PUSH.S fstring #emit PUSH.C 255 #emit PUSH.ADR message n+=4*3; #emit PUSH.S n #emit SYSREQ.C format n+=4; #emit LCTRL 4 #emit LOAD.S.alt n #emit ADD #emit SCTRL 4 return SendClientMessage(playerid,color,message); } else return SendClientMessage(playerid,color,fstring); }