#include <a_samp>#define Loop(%0,%1) \\for(new %0; %0 != %1; %0++) // Macro #define GEAR_KEY KEY_FIRE // Váltáshoz használandó gombnewtimer[MAX_PLAYERS], // IdõzítõText: GearInfo[MAX_PLAYERS], // R N DText: Speedo[MAX_PLAYERS], // SebmérõText: General[5], // StruktúraText: Gear[6], //cGear[MAX_VEHICLES], // current gearwarn[MAX_VEHICLES], // Sebesség magas/alacsonygul[MAX_VEHICLES] //; forward ShiftFunction(playerid);public OnFilterScriptInit(){General[0] = TextDrawCreate(554.000000, 414.000000, \"_\");TextDrawBackgroundColor(General[0], 255);TextDrawFont(General[0], 1);TextDrawLetterSize(General[0], 0.500000, 2.599999);TextDrawColor(General[0], -1);TextDrawSetOutline(General[0], 0);TextDrawSetProportional(General[0], 1);TextDrawSetShadow(General[0], 1);TextDrawUseBox(General[0], 1);TextDrawBoxColor(General[0], 70);TextDrawTextSize(General[0], 628.000000, 0.000000);General[1] = TextDrawCreate(554.000000, 440.000000, \"_\");TextDrawBackgroundColor(General[1], 255);TextDrawFont(General[1], 1);TextDrawLetterSize(General[1], 0.500000, -0.300000);TextDrawColor(General[1], -1);TextDrawSetOutline(General[1], 0);TextDrawSetProportional(General[1], 1);TextDrawSetShadow(General[1], 1);TextDrawUseBox(General[1], 1);TextDrawBoxColor(General[1], 120);TextDrawTextSize(General[1], 628.000000, 0.000000);General[2] = TextDrawCreate(554.000000, 414.000000, \"_\");TextDrawBackgroundColor(General[2], 255);TextDrawFont(General[2], 1);TextDrawLetterSize(General[2], 0.500000, -0.300000);TextDrawColor(General[2], -1);TextDrawSetOutline(General[2], 0);TextDrawSetProportional(General[2], 1);TextDrawSetShadow(General[2], 1);TextDrawUseBox(General[2], 1);TextDrawBoxColor(General[2], 120);TextDrawTextSize(General[2], 628.000000, 0.000000);General[3] = TextDrawCreate(631.000000, 414.000000, \"_\");TextDrawBackgroundColor(General[3], 255);TextDrawFont(General[3], 1);TextDrawLetterSize(General[3], 0.500000, 2.599999);TextDrawColor(General[3], -1);TextDrawSetOutline(General[3], 0);TextDrawSetProportional(General[3], 1);TextDrawSetShadow(General[3], 1);TextDrawUseBox(General[3], 1);TextDrawBoxColor(General[3], 120);TextDrawTextSize(General[3], 629.000000, 0.000000);General[4] = TextDrawCreate(554.000000, 414.000000, \"_\");TextDrawBackgroundColor(General[4], 255);TextDrawFont(General[4], 1);TextDrawLetterSize(General[4], 0.500000, 2.599999);TextDrawColor(General[4], -1);TextDrawSetOutline(General[4], 0);TextDrawSetProportional(General[4], 1);TextDrawSetShadow(General[4], 1);TextDrawUseBox(General[4], 1);TextDrawBoxColor(General[4], 120);TextDrawTextSize(General[4], 550.000000, 0.000000);Gear[0] = TextDrawCreate(558.000000, 430.000000, \"_\");TextDrawBackgroundColor(Gear[0], 255);TextDrawFont(Gear[0], 1);TextDrawLetterSize(Gear[0], 0.500000, 0.399999);TextDrawColor(Gear[0], -1);TextDrawSetOutline(Gear[0], 0);TextDrawSetProportional(Gear[0], 1);TextDrawSetShadow(Gear[0], 1);TextDrawUseBox(Gear[0], 1);TextDrawBoxColor(Gear[0], -1);TextDrawTextSize(Gear[0], 553.000000, 0.000000);Gear[1] = TextDrawCreate(562.000000, 427.399993, \"_\");TextDrawBackgroundColor(Gear[1], 255);TextDrawFont(Gear[1], 1);TextDrawLetterSize(Gear[1], 0.549999, 0.699999);TextDrawColor(Gear[1], -1);TextDrawSetOutline(Gear[1], 0);TextDrawSetProportional(Gear[1], 1);TextDrawSetShadow(Gear[1], 1);TextDrawUseBox(Gear[1], 1);TextDrawBoxColor(Gear[1], -151807233);TextDrawTextSize(Gear[1], 557.000000, 0.000000);Gear[2] = TextDrawCreate(566.000000, 424.600006, \"_\");TextDrawBackgroundColor(Gear[2], 255);TextDrawFont(Gear[2], 1);TextDrawLetterSize(Gear[2], 0.549999, 1.000000);TextDrawColor(Gear[2], -1);TextDrawSetOutline(Gear[2], 0);TextDrawSetProportional(Gear[2], 1);TextDrawSetShadow(Gear[2], 1);TextDrawUseBox(Gear[2], 1);TextDrawBoxColor(Gear[2], -1823745);TextDrawTextSize(Gear[2], 561.000000, 0.000000);Gear[3] = TextDrawCreate(570.000000, 422.000000, \"_\");TextDrawBackgroundColor(Gear[3], 255);TextDrawFont(Gear[3], 1);TextDrawLetterSize(Gear[3], 0.549999, 1.300000);TextDrawColor(Gear[3], -1);TextDrawSetOutline(Gear[3], 0);TextDrawSetProportional(Gear[3], 1);TextDrawSetShadow(Gear[3], 1);TextDrawUseBox(Gear[3], 1);TextDrawBoxColor(Gear[3], -1813566465);TextDrawTextSize(Gear[3], 565.000000, 0.000000);Gear[4] = TextDrawCreate(574.000000, 419.299987, \"_\");TextDrawBackgroundColor(Gear[4], 255);TextDrawFont(Gear[4], 1);TextDrawLetterSize(Gear[4], 0.549999, 1.600000);TextDrawColor(Gear[4], -1);TextDrawSetOutline(Gear[4], 0);TextDrawSetProportional(Gear[4], 1);TextDrawSetShadow(Gear[4], 1);TextDrawUseBox(Gear[4], 1);TextDrawBoxColor(Gear[4], -1813566465);TextDrawTextSize(Gear[4], 569.000000, 0.000000);Gear[5] = TextDrawCreate(578.000000, 417.299987, \"_\");TextDrawBackgroundColor(Gear[5], 255);TextDrawFont(Gear[5], 1);TextDrawLetterSize(Gear[5], 0.549999, 1.800000);TextDrawColor(Gear[5], -1);TextDrawSetOutline(Gear[5], 0);TextDrawSetProportional(Gear[5], 1);TextDrawSetShadow(Gear[5], 1);TextDrawUseBox(Gear[5], 1);TextDrawBoxColor(Gear[5], -16776961);TextDrawTextSize(Gear[5], 573.000000, 0.000000);print(\"\\n--------------------------------------\");print(\"Sebességváltó rendszer by ReMoTe\");print(\"--------------------------------------\\n\");return 1;}public OnPlayerDisconnect(playerid, reason){KillTimer(timer[playerid]);TextDrawDestroy(GearInfo[playerid]);TextDrawDestroy(Speedo[playerid]);return 1;}public OnPlayerConnect(playerid){ GearInfo[playerid] = TextDrawCreate(596.000000, 425.000000, \"~w~R ~g~~h~N ~w~D\");TextDrawBackgroundColor(GearInfo[playerid], 255);TextDrawFont(GearInfo[playerid], 1);TextDrawLetterSize(GearInfo[playerid], 0.320000, 1.299999);TextDrawColor(GearInfo[playerid], -1);TextDrawSetOutline(GearInfo[playerid], 0);TextDrawSetProportional(GearInfo[playerid], 1);TextDrawSetShadow(GearInfo[playerid], 1);Speedo[playerid] = TextDrawCreate(579.000000, 414.000000, \"255 ~w~km/h\");TextDrawBackgroundColor(Speedo[playerid], 0x000000FF);TextDrawFont(Speedo[playerid], 1);TextDrawLetterSize(Speedo[playerid], 0.170000, 0.799999);TextDrawColor(Speedo[playerid], 0xA803D0FF);TextDrawSetOutline(Speedo[playerid], 0);TextDrawSetProportional(Speedo[playerid], 1);TextDrawSetShadow(Speedo[playerid], 1); timer[playerid] = SetTimerEx(\"ShiftFunction\",150,true,\"i\",playerid);return 1;}stock GetSpeed(playerid){new Float:ST[3];GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);return floatround(1.61*floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 100.3);}public ShiftFunction(playerid){if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){static Float: Speed, string[24], veh, model;veh = GetPlayerVehicleID(playerid),model = GetVehicleModel(veh);if(model == 481 || model == 510 || model == 509) return 1; // MotorokLoop(x, 5) TextDrawShowForPlayer(playerid, General
#include <a_samp>forward motor( playerid );public OnFilterScriptInit(){print(\"\\n--------------------------------------\");print(\" ZyZu Jármû sebesség szkript betöltve!\");print(\"--------------------------------------\\n\");return 1;}stock GetPlayerSpeed(playerid,bool:kmh){ new Float:Vx,Float:Vy,Float:Vz,Float:rtn; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz); rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2))); return kmh?floatround(rtn * 90 * 1.61):floatround(rtn * 90); GameTextForPlayer(playerid,\"MOTOR FULLAD!\", 3000, 1); SendClientMessage(playerid,\"Vigyázz a motor migyárt lefuladd! Nyomd meg a SPACE gombot!\"); SetTimer(\"motor\", 2000, false);}public motor( playerid ){new vehicle = GetPlayerVehicleID(playerid);new engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);RemovePlayerFromVehicle(playerid);return 1;}public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){if(newkeys == KEY_SPRINT){KillTimer( motor );}return 1;}
return kmh?floatround(rtn * 90 * 1.61):floatround(rtn * 90);
megöli a timert[/quote]Jesszus..
#include <a_samp>#include <setvehiclespeed>#define function%0(%1) forward%0(%1);public%0(%1)new DieTimer[MAX_PLAYERS],bool:pWarned[MAX_PLAYERS] = false;public OnFilterScriptInit() SetTimer(\"UpdateSpeed\", 1000, true);public OnFilterScriptExit() for(new i = 0; i < MAX_PLAYERS; i++) KillTimer(DieTimer);public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {if(newkeys == KEY_SPRINT) KillTimer(motor), pWarned[playerid] = false;return 1;}function UpdateSpeed() {for(new i = 0; i < MAX_PLAYERS; i++) {if(!IsPlayerConnected(i)) continue;if(!IsPlayerInAnyVehicle(i)) continue;if(GetVehicleSpeed(GetPlayerVehicleID(i)) > 90) { if(pWarned) continue; pWarned = true; GameTextForPlayer(playerid,\"MOTOR FULLAD!\", 3000, 1); SendClientMessage(playerid,\"Vigyázz a motor migyárt lefuladd! Nyomd meg a SPACE gombot!\"); DieTimer = SetTimerEx(\"motor\", 3000, false, \"d\", i);}}}function motor(playerid) {new vehicle = GetPlayerVehicleID(playerid);new engine, lights, alarm, doors, bonnet, boot, objective;GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);SetVehiclespeed(GetPlayervehicleID(playerid), 0);pWarned[playerid] = false;return 1;}
http://sampforum.hu/index.php?topic=27551.0 --> ez kell hozzá #include <a_samp>#include <setvehiclespeed>#define function%0(%1) forward%0(%1);public%0(%1)new DieTimer[MAX_PLAYERS],bool:pWarned[MAX_PLAYERS] = false;public OnFilterScriptInit() SetTimer(\"UpdateSpeed\", 1000, true);public OnFilterScriptExit() for(new i = 0; i < MAX_PLAYERS; i++) KillTimer(DieTimer);public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {if(newkeys == KEY_SPRINT) KillTimer(motor), pWarned[playerid] = false;return 1;}function UpdateSpeed() {for(new i = 0; i < MAX_PLAYERS; i++) {if(!IsPlayerConnected(i)) continue;if(!IsPlayerInAnyVehicle(i)) continue;if(GetVehicleSpeed(GetPlayerVehicleID(i)) > 90) { if(pWarned) continue; pWarned = true; GameTextForPlayer(playerid,\"MOTOR FULLAD!\", 3000, 1); SendClientMessage(playerid,\"Vigyázz a motor migyárt lefuladd! Nyomd meg a SPACE gombot!\"); DieTimer = SetTimerEx(\"motor\", 3000, false, \"d\", i);}}}function motor(playerid) {new vehicle = GetPlayerVehicleID(playerid);new engine, lights, alarm, doors, bonnet, boot, objective;GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);SetVehiclespeed(GetPlayervehicleID(playerid), 0);pWarned[playerid] = false;return 1;} Nem teszteltem, de ránézésre jónak néz ki xD
#include <a_samp>#include <setvehiclespeed>#define function%0(%1) forward%0(%1);public%0(%1)#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))#define RELEASED(%0) (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))new PlayerText:Valto,DieTimer[MAX_PLAYERS],ValtoSebesseg[MAX_PLAYERS],bool:pWarned[MAX_PLAYERS] = false,pSpeed[] = { 30, 60, 90, 120, 150, 180 }; //sebességek, amiknél váltani kell.public OnFilterScriptInit() SetTimer(\"UpdateSpeed\", 200, true);public OnFilterScriptExit() for(new i = 0; i < MAX_PLAYERS; i++) KillTimer(DieTimer);public OnPlayerConnect(playerid) { Valto = CreatePlayerTextDraw(playerid, 550.000000, 350.000000, \"_\");PlayerTextDrawBackgroundColor(playerid, Valto, -1);PlayerTextDrawFont(playerid, Valto, 1);PlayerTextDrawLetterSize(playerid, Valto, 0.500000, 1.000000);PlayerTextDrawColor(playerid, Valto, 255);PlayerTextDrawSetOutline(playerid, Valto, 1);PlayerTextDrawSetProportional(playerid, Valto, 1);PlayerTextDrawUseBox(playerid, Valto, 1);PlayerTextDrawBoxColor(playerid, Valto, 255);PlayerTextDrawTextSize(playerid, Valto, 640.000000, 0.000000);PlayerTextDrawHide(playerid, Valto);return 1;}public OnPlayerStateChange(playerid, newstate, oldstate) {if(newstate == PLAYER_STATE_DRIVER) PlayerTextDrawShow(playerid, Valto), ValtoSebesseg[playerid] = 0;else PlayerTextDrawHide(playerid, Valto);if(newstate == PLAYER_STATE_DRIVER) { new engine, lights, alarm, doors, bonnet, boot, objective;GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, lights, alarm, doors, bonnet, boot, objective);}return 1;}public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {if(PRESSED(KEY_YES)) {KillTimer(DieTimer[playerid]);pWarned[playerid] = false;ValtoSebesseg[playerid] += 1;}if(RELEASED(KEY_NO)) {ValtoSebesseg[playerid] -= 1;}return 1;}function UpdateSpeed() { new string[32];for(new i = 0; i < MAX_PLAYERS; i++) {if(!IsPlayerConnected(i)) continue;if(!IsPlayerInAnyVehicle(i)) continue;for(new j = 0; j < sizeof(pSpeed); j++) { if((GetVehicleSpeed(GetPlayerVehicleID(i)) > pSpeed[j]) && ValtoSebesseg == j) { if(pWarned) continue; pWarned = true; format(string, sizeof(string), \"Valto: %d~n~Limit: %d\", ValtoSebesseg, pSpeed[j]); PlayerTextDrawSetString(i, Valto, string); GameTextForPlayer(playerid, \"~r~Motor Fullad!\", 2000, 6); //kiírja, hogy mi a gond DieTimer = SetTimerEx(\"motor\", 3000, false, \"d\", i); } else if(GetVehicleSpeed(GetPlayerVehicleID(i) < pSpeed[j])) { pWarned = false; KillTimer(DieTimer); }}}}function motor(playerid) {new vehicle = GetPlayerVehicleID(playerid);new engine, lights, alarm, doors, bonnet, boot, objective;GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);SetVehicleSpeed(GetPlayerVehicleID(playerid), 0);SetVehicleHealth(GetPlayerVehicleID(playerid), 400.0);pWarned[playerid] = false;ValtoSebesseg[playerid] = 0;return 1;}