Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Data utworzenia skryptu: 26.07.2014
- Data zakończenia skryptu: 26.07.2014 2godz. później
- Autor: ReveresPL
- Opis: Skrypt dodaje do gry okrągły licznik.
- Zakaz zmiany autora ! i wstawiania tego skryptu na inne fora niż (pawno.pl) bez zgody autora !!! ReveresPL
- */
- #define FILTERSCRIPT
- #include <a_samp>
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 5
- #define FRESH_TIMER 250 //Czas w ms. odświeżania licznika (nie zaleca się dawać mniejszych wartości niż 250)
- //
- new Text:Box1;
- new Text:Box2;
- new Text:s0;
- new Text:s1;
- new Text:s2;
- new Text:s3;
- new Text:s4;
- new Text:s5;
- new Text:s6;
- new Text:s7;
- new Text:s8;
- new Text:s9;
- new Text:s10;
- new Text:s11;
- new Text:wsk[MAX_PLAYERS];
- //
- new speed[MAX_PLAYERS];
- new act_speed[MAX_PLAYERS];
- new licznik[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Circle Speedometr .... by ReveresPL");
- print("--------------------------------------\n");
- //
- LoadTD();
- print(" ***Skrypt załadowany ***");
- return 1;
- }
- public OnFilterScriptExit()
- {
- UnloadTD();
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(licznik[playerid])
- {
- licznik[playerid]=false;
- HideTD(playerid);
- KillTimer(speed[playerid]);
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(newstate == PLAYER_STATE_DRIVER)
- {
- licznik[playerid]=true;
- ShowTD(playerid);
- speed[playerid] = SetTimerEx("Speedometr", FRESH_TIMER, true, "i", playerid);
- }
- if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
- {
- licznik[playerid]=false;
- HideTD(playerid);
- KillTimer(speed[playerid]);
- }
- return 1;
- }
- stock LoadTD()
- {
- Box1 = TextDrawCreate(506.799926, 271.096191, "LD_POOL:ball");
- TextDrawLetterSize(Box1, 0.000000, 0.000000);
- TextDrawTextSize(Box1, 120.399993, 94.583976);
- TextDrawAlignment(Box1, 1);
- TextDrawColor(Box1, 255);
- TextDrawSetShadow(Box1, 0);
- TextDrawSetOutline(Box1, 0);
- TextDrawFont(Box1, 4);
- TextDrawSetPreviewModel(Box1, 19348);
- TextDrawSetPreviewRot(Box1, 0.000000, 90.000000, 0.000000, 1.000000);
- Box2 = TextDrawCreate(509.049926, 272.832000, "LD_POOL:ball");
- TextDrawLetterSize(Box2, 0.000000, 0.000000);
- TextDrawTextSize(Box2, 116.350006, 90.775962);
- TextDrawAlignment(Box2, 1);
- TextDrawColor(Box2, -1);
- TextDrawSetShadow(Box2, 0);
- TextDrawSetOutline(Box2, 0);
- TextDrawFont(Box2, 4);
- s0 = TextDrawCreate(526.500000, 333.199951, "0");
- TextDrawLetterSize(s0, 0.250050, 1.300400);
- TextDrawAlignment(s0, 1);
- TextDrawColor(s0, -16776961);
- TextDrawSetShadow(s0, 0);
- TextDrawSetOutline(s0, 0);
- TextDrawBackgroundColor(s0, 255);
- TextDrawFont(s0, 2);
- TextDrawSetProportional(s0, 1);
- s1 = TextDrawCreate(515.500000, 321.999877, "20");
- TextDrawLetterSize(s1, 0.250399, 1.300401);
- TextDrawAlignment(s1, 1);
- TextDrawColor(s1, -16776961);
- TextDrawSetShadow(s1, 0);
- TextDrawSetOutline(s1, 0);
- TextDrawBackgroundColor(s1, 255);
- TextDrawFont(s1, 2);
- TextDrawSetProportional(s1, 1);
- s2 = TextDrawCreate(513.500000, 308.559906, "40");
- TextDrawLetterSize(s2, 0.250500, 1.300960);
- TextDrawAlignment(s2, 1);
- TextDrawColor(s2, -16776961);
- TextDrawSetShadow(s2, 0);
- TextDrawSetOutline(s2, 0);
- TextDrawBackgroundColor(s2, 255);
- TextDrawFont(s2, 2);
- TextDrawSetProportional(s2, 1);
- s3 = TextDrawCreate(518.099853, 292.879791, "60");
- TextDrawLetterSize(s3, 0.250000, 1.300400);
- TextDrawAlignment(s3, 1);
- TextDrawColor(s3, -16776961);
- TextDrawSetShadow(s3, 0);
- TextDrawSetOutline(s3, 0);
- TextDrawBackgroundColor(s3, 255);
- TextDrawFont(s3, 2);
- TextDrawSetProportional(s3, 1);
- s4 = TextDrawCreate(530.500000, 281.679962, "80");
- TextDrawLetterSize(s4, 0.250999, 1.300960);
- TextDrawAlignment(s4, 1);
- TextDrawColor(s4, -16776961);
- TextDrawSetShadow(s4, 0);
- TextDrawSetOutline(s4, 0);
- TextDrawBackgroundColor(s4, 255);
- TextDrawFont(s4, 2);
- TextDrawSetProportional(s4, 1);
- s5 = TextDrawCreate(545.500000, 274.959960, "100");
- TextDrawLetterSize(s5, 0.250499, 1.300400);
- TextDrawAlignment(s5, 1);
- TextDrawColor(s5, -16776961);
- TextDrawSetShadow(s5, 0);
- TextDrawSetOutline(s5, 0);
- TextDrawBackgroundColor(s5, 255);
- TextDrawFont(s5, 2);
- TextDrawSetProportional(s5, 1);
- s6 = TextDrawCreate(568.400085, 274.959960, "120");
- TextDrawLetterSize(s6, 0.250500, 1.300400);
- TextDrawAlignment(s6, 1);
- TextDrawColor(s6, -16776961);
- TextDrawSetShadow(s6, 0);
- TextDrawSetOutline(s6, 0);
- TextDrawFont(s6, 2);
- TextDrawBackgroundColor(s6, 255);
- TextDrawSetProportional(s6, 1);
- s7 = TextDrawCreate(587.000000, 281.679931, "140");
- TextDrawLetterSize(s7, 0.250999, 1.300400);
- TextDrawAlignment(s7, 1);
- TextDrawColor(s7, -16776961);
- TextDrawSetShadow(s7, 0);
- TextDrawSetOutline(s7, 0);
- TextDrawBackgroundColor(s7, 255);
- TextDrawFont(s7, 2);
- TextDrawSetProportional(s7, 1);
- s8 = TextDrawCreate(597.500000, 292.880004, "160");
- TextDrawLetterSize(s8, 0.250499, 1.300959);
- TextDrawAlignment(s8, 1);
- TextDrawColor(s8, -16776961);
- TextDrawSetShadow(s8, 0);
- TextDrawSetOutline(s8, 0);
- TextDrawBackgroundColor(s8, 255);
- TextDrawFont(s8, 2);
- TextDrawSetProportional(s8, 1);
- s9 = TextDrawCreate(601.500000, 308.000061, "180");
- TextDrawLetterSize(s9, 0.250999, 1.300959);
- TextDrawAlignment(s9, 1);
- TextDrawColor(s9, -16776961);
- TextDrawSetShadow(s9, 0);
- TextDrawSetOutline(s9, 0);
- TextDrawBackgroundColor(s9, 255);
- TextDrawFont(s9, 2);
- TextDrawSetProportional(s9, 1);
- s10 = TextDrawCreate(600.500000, 321.439941, "200");
- TextDrawLetterSize(s10, 0.250500, 1.300960);
- TextDrawAlignment(s10, 1);
- TextDrawColor(s10, -16776961);
- TextDrawSetShadow(s10, 0);
- TextDrawSetOutline(s10, 0);
- TextDrawBackgroundColor(s10, 255);
- TextDrawFont(s10, 2);
- TextDrawSetProportional(s10, 1);
- s11 = TextDrawCreate(594.000000, 331.519836, "220");
- TextDrawLetterSize(s11, 0.250500, 1.300400);
- TextDrawAlignment(s11, 1);
- TextDrawColor(s11, -16776961);
- TextDrawSetShadow(s11, 0);
- TextDrawSetOutline(s11, 0);
- TextDrawBackgroundColor(s11, 255);
- TextDrawFont(s11, 2);
- TextDrawSetProportional(s11, 1);
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- wsk[i] = TextDrawCreate(531.000000, 338.800018, "wsk");
- TextDrawLetterSize(wsk[i], 0.449999, 1.600000);
- TextDrawTextSize(wsk[i], 70.500000, -59.360008);
- TextDrawAlignment(wsk[i], 1);
- TextDrawColor(wsk[i], -1);
- TextDrawUseBox(wsk[i], true);
- TextDrawBoxColor(wsk[i], 0x00000000);
- TextDrawBackgroundColor(wsk[i], 0x00000000);
- TextDrawFont(wsk[i], TEXT_DRAW_FONT_MODEL_PREVIEW);
- TextDrawSetPreviewModel(wsk[i], 19348);
- TextDrawSetPreviewRot(wsk[i], 0.0, 70.0, 0.0, 1.0);
- }
- }
- stock UnloadTD()
- {
- TextDrawDestroy(Box1);
- TextDrawDestroy(Box2);
- TextDrawDestroy(s0);
- TextDrawDestroy(s1);
- TextDrawDestroy(s2);
- TextDrawDestroy(s3);
- TextDrawDestroy(s4);
- TextDrawDestroy(s5);
- TextDrawDestroy(s6);
- TextDrawDestroy(s7);
- TextDrawDestroy(s8);
- TextDrawDestroy(s9);
- TextDrawDestroy(s10);
- TextDrawDestroy(s11);
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- TextDrawDestroy(wsk[i]);
- }
- }
- stock ShowTD(playerid)
- {
- TextDrawShowForPlayer(playerid, Box1);
- TextDrawShowForPlayer(playerid, Box2);
- TextDrawShowForPlayer(playerid, s0);
- TextDrawShowForPlayer(playerid, s1);
- TextDrawShowForPlayer(playerid, s2);
- TextDrawShowForPlayer(playerid, s3);
- TextDrawShowForPlayer(playerid, s4);
- TextDrawShowForPlayer(playerid, s5);
- TextDrawShowForPlayer(playerid, s6);
- TextDrawShowForPlayer(playerid, s7);
- TextDrawShowForPlayer(playerid, s8);
- TextDrawShowForPlayer(playerid, s9);
- TextDrawShowForPlayer(playerid, s10);
- TextDrawShowForPlayer(playerid, s11);
- TextDrawShowForPlayer(playerid, wsk[playerid]);
- }
- stock HideTD(playerid)
- {
- TextDrawHideForPlayer(playerid, Box1);
- TextDrawHideForPlayer(playerid, Box2);
- TextDrawHideForPlayer(playerid, s0);
- TextDrawHideForPlayer(playerid, s1);
- TextDrawHideForPlayer(playerid, s2);
- TextDrawHideForPlayer(playerid, s3);
- TextDrawHideForPlayer(playerid, s4);
- TextDrawHideForPlayer(playerid, s5);
- TextDrawHideForPlayer(playerid, s6);
- TextDrawHideForPlayer(playerid, s7);
- TextDrawHideForPlayer(playerid, s8);
- TextDrawHideForPlayer(playerid, s9);
- TextDrawHideForPlayer(playerid, s10);
- TextDrawHideForPlayer(playerid, s11);
- TextDrawHideForPlayer(playerid, wsk[playerid]);
- }
- forward Speedometr(playerid);
- public Speedometr(playerid)
- {
- //TextDrawHideForPlayer(playerid, wsk[playerid]);
- act_speed[playerid] = GetVehicleSpeed(GetPlayerVehicleID(playerid));
- if(act_speed[playerid] >= 0){
- TextDrawSetPreviewRot(wsk[playerid], 0, act_speed[playerid]+70, 0, 1);
- }else if(act_speed[playerid] > 220){
- TextDrawSetPreviewRot(wsk[playerid], 0, 300, 0, 1);
- }
- TextDrawShowForPlayer(playerid, wsk[playerid]);
- return 1;
- }
- stock GetVehicleSpeed(vehicleid)
- {
- new Float:xyz[3];
- GetVehicleVelocity(vehicleid, xyz[0], xyz[1], xyz[2]);
- return floatround(floatsqroot(floatpower(xyz[0], 2) + floatpower(xyz[1], 2) + floatpower(xyz[2], 2)) * 200);
- }
- //Zakaz zmiany autora ! i wstawiania tego skryptu na inne fora niż (pawno.pl) bez zgody autora !!! ReveresPL
Advertisement
Add Comment
Please, Sign In to add comment