//------------SPEEDOMETER---------------------------------------------public SpeedMeter(playerid){ if(IsPlayerInAnyVehicle(playerid)) { new Float: vPos[3],Float: Speed,string[128]; new Float:health; GetVehicleHealth(GetPlayerVehicleID(playerid), health); new vehicle = GetPlayerVehicleID(playerid); new fuel = 100; // NOTE: HERE YOU PUT YOUR FUEL SYSTEM FUNCTION (instead of 100 something like Gas[GetPlayerVehicleID(playerid)] for Godfather) IF YOU WANT TO INCLUDE IT ON YOUR GAMEMODE! if(VehicleEngine[vehicle] != 1) { return 1; } if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { format(string, sizeof(string), \"%s\",VehicleName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]), TextDrawSetString(Textdraws1[playerid],string),TextDrawShowForPlayer(playerid, Textdraws1[playerid]); if(fuel <= 100 && fuel >= 90) { TextDrawSetString(Textdraws3[playerid],\"------------\"); } if(fuel <= 90 && fuel >= 80) { TextDrawSetString(Textdraws3[playerid],\"-----------\"); } if(fuel <= 80 && fuel >= 70) { TextDrawSetString(Textdraws3[playerid],\"----------\"); } if(fuel <= 70 && fuel >= 60) { TextDrawSetString(Textdraws3[playerid],\"---------\"); } if(fuel <= 60 && fuel >= 50) { TextDrawSetString(Textdraws3[playerid],\"--------\"); } if(fuel <= 50 && fuel >= 40) { TextDrawSetString(Textdraws3[playerid],\"-------\"); } if(fuel <= 40 && fuel >= 30) { TextDrawSetString(Textdraws3[playerid],\"~y~------\"); } if(fuel <= 30 && fuel >= 20) { TextDrawSetString(Textdraws3[playerid],\"~y~-----\"); } if(fuel <= 20 && fuel >= 15) { TextDrawSetString(Textdraws3[playerid],\"~y~----\"); } if(fuel <= 15 && fuel >= 10) { TextDrawSetString(Textdraws3[playerid],\"~y~---\"); } if(fuel <= 10 && fuel >= 5) { TextDrawSetString(Textdraws3[playerid],\"~y~--\"); } TextDrawShowForPlayer(playerid, Textdraws2[playerid]); TextDrawShowForPlayer(playerid, Textdraws3[playerid]); TextDrawShowForPlayer(playerid, Textdraws4[playerid]); if(!IsVehicleDrivingBackwards(GetPlayerVehicleID(playerid))) { GetVehicleVelocity(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]); Speed = floatmul(floatsqroot(floatadd(floatpower(vPos[0], 2), floatadd(floatpower(vPos[1], 2), floatpower(vPos[2], 2)))), 200); format(string, sizeof(string), \"%0.0f\", Speed), TextDrawSetString(Textdraws5[playerid], string), TextDrawShowForPlayer(playerid, Textdraws5[playerid]); if(Speed < 1) { TextDrawHideForPlayer(playerid, Textdraws0[playerid]); TextDrawSetString(Textdraws0[playerid], \"~w~R ~p~N ~w~D\"), TextDrawShowForPlayer(playerid, Textdraws0[playerid]); } if(Speed > 1) { TextDrawHideForPlayer(playerid, Textdraws0[playerid]); TextDrawSetString(Textdraws0[playerid], \"~w~R ~w~N ~p~D\"), TextDrawShowForPlayer(playerid, Textdraws0[playerid]); } return 1; } } if(IsVehicleDrivingBackwards(GetPlayerVehicleID(playerid))) { TextDrawSetString(Textdraws0[playerid], \"~p~R ~w~N ~w~D\"), TextDrawShowForPlayer(playerid, Textdraws0[playerid]); TextDrawSetString(Textdraws5[playerid], \"~r~0\"), TextDrawShowForPlayer(playerid, Textdraws5[playerid]); return 1; } } else if(speedmeteron[playerid] == 1) { speedmeteron[playerid] = 0; KillTimer(speedmetertimer[playerid]); HideSpeedMeter(playerid); } return 1;} stock IsVehicleDrivingBackwards(vehicleid) // By Joker Thank you{ new Float:Float[3]; if(GetVehicleVelocity(vehicleid, Float[1], Float[2], Float[0])) { GetVehicleZAngle(vehicleid, Float[0]); if(Float[0] < 90) { if(Float[1] > 0 && Float[2] < 0) return true; } else if(Float[0] < 180) { if(Float[1] > 0 && Float[2] > 0) return true; } else if(Float[0] < 270) { if(Float[1] < 0 && Float[2] > 0) return true; } else if(Float[1] < 0 && Float[2] < 0) return true; } return false;} public HideSpeedMeter(playerid){ TextDrawHideForPlayer(playerid, Textdraws0[playerid]); TextDrawHideForPlayer(playerid, Textdraws1[playerid]); TextDrawHideForPlayer(playerid, Textdraws2[playerid]); TextDrawHideForPlayer(playerid, Textdraws3[playerid]); TextDrawHideForPlayer(playerid, Textdraws4[playerid]); TextDrawHideForPlayer(playerid, Textdraws5[playerid]);}
if(newstate == PLAYER_STATE_DRIVER){ TextDrawShowForPlayer(playerid, Textdraws0[playerid]); TextDrawShowForPlayer(playerid, Textdraws1[playerid]); TextDrawShowForPlayer(playerid, Textdraws2[playerid]); TextDrawShowForPlayer(playerid, Textdraws3[playerid]); TextDrawShowForPlayer(playerid, Textdraws4[playerid]); TextDrawShowForPlayer(playerid, Textdraws5[playerid]);}if(newstate == PLAYER_STATE_NONE){ TextDrawHideForPlayer(playerid, Textdraws0[playerid]); TextDrawHideForPlayer(playerid, Textdraws1[playerid]); TextDrawHideForPlayer(playerid, Textdraws2[playerid]); TextDrawHideForPlayer(playerid, Textdraws3[playerid]); TextDrawHideForPlayer(playerid, Textdraws4[playerid]); TextDrawHideForPlayer(playerid, Textdraws5[playerid]);}
D:\\SAMP\\SAMP-Server\\gamemodes\\RPG.pwn(410) : error 017: undefined symbol \"speedmeteron\"D:\\SAMP\\SAMP-Server\\gamemodes\\RPG.pwn(410) : warning 215: expression has no effectD:\\SAMP\\SAMP-Server\\gamemodes\\RPG.pwn(410) : error 001: expected token: \";\", but found \"]\"D:\\SAMP\\SAMP-Server\\gamemodes\\RPG.pwn(410) : error 029: invalid expression, assumed zeroD:\\SAMP\\SAMP-Server\\gamemodes\\RPG.pwn(410) : fatal error 107: too many error messages on one line
public OnPlayerDeath(playerid, killerid, reason){ if(speedmeteron[playerid] == 1) { speedmeteron[playerid] = 0; KillTimer(speedmetertimer[playerid]); HideSpeedMeter(playerid); } return 1;}
Hiába rakom be a textdrawot amit adtál akkor sem jó, ha meg módba rakom bele akkor ezt írja ki. D:\\SAMP\\SAMP-Server\\gamemodes\\RPG.pwn(410) : error 017: undefined symbol \"speedmeteron\"D:\\SAMP\\SAMP-Server\\gamemodes\\RPG.pwn(410) : warning 215: expression has no effectD:\\SAMP\\SAMP-Server\\gamemodes\\RPG.pwn(410) : error 001: expected token: \";\", but found \"]\"D:\\SAMP\\SAMP-Server\\gamemodes\\RPG.pwn(410) : error 029: invalid expression, assumed zeroD:\\SAMP\\SAMP-Server\\gamemodes\\RPG.pwn(410) : fatal error 107: too many error messages on one line Ez a sor a 410: public OnPlayerDeath(playerid, killerid, reason){ if(speedmeteron[playerid] == 1) { speedmeteron[playerid] = 0; KillTimer(speedmetertimer[playerid]); HideSpeedMeter(playerid); } return 1;}
new speedmeteron[MAX_PLAYERS];
#define FILTERSCRIPT #include <a_samp> #if defined FILTERSCRIPT forward SpeedMeter(playerid);forward HideSpeedMeter(playerid);//-----SPEEDMETERTEXT----------new Text:Textdraws0[MAX_PLAYERS];new Text:Textdraws1[MAX_PLAYERS];new Text:Textdraws2[MAX_PLAYERS];new Text:Textdraws3[MAX_PLAYERS];new Text:Textdraws4[MAX_PLAYERS];new Text:Textdraws5[MAX_PLAYERS];new speedmetertimer[MAX_PLAYERS];new speedmeteron[MAX_PLAYERS];new VehicleEngine[MAX_VEHICLES]; public OnFilterScriptInit(){ print(\"\\n--------------------------------------\"); print(\" CØde Speedometer v 1\"); print(\"--------------------------------------\\n\"); return 1;} new VehicleName[][] = { \"Landstalker\", \"Bravura\", \"Buffalo\", \"Linerunner\", \"Pereniel\", \"Sentinel\", \"Dumper\", \"Firetruck\", \"Trashmaster\", \"Stretch\", \"Manana\", \"Infernus\", \"Voodoo\", \"Pony\", \"Mule\", \"Cheetah\", \"Ambulance\", \"Leviathan\", \"Moonbeam\", \"Esperanto\", \"Taxi\", \"Washington\", \"Bobcat\", \"Mr Whoopee\", \"BF Injection\", \"Hunter\", \"Premier\", \"Enforcer\", \"Securicar\", \"Banshee\", \"Predator\", \"Bus\", \"Rhino\", \"Barracks\", \"Hotknife\", \"Trailer\", \"Previon\", \"Coach\", \"Cabbie\", \"Stallion\", \"Rumpo\", \"RC Bandit\", \"Romero\", \"Packer\", \"Monster Truck\", \"Admiral\", \"Squalo\", \"Seasparrow\", \"Pizzaboy\", \"Tram\", \"Trailer\", \"Turismo\", \"Speeder\", \"Reefer\", \"Tropic\", \"Flatbed\", \"Yankee\", \"Caddy\", \"Solair\", \"Berkley\'s RC Van\", \"Skimmer\", \"PCJ-600\", \"Faggio\", \"Freeway\", \"RC Baron\", \"RC Raider\", \"Glendale\", \"Oceanic\", \"Sanchez\", \"Sparrow\", \"Patriot\", \"Quad\", \"Coastguard\", \"Dinghy\", \"Hermes\", \"Sabre\", \"Rustler\", \"ZR-350\", \"Walton\", \"Regina\", \"Comet\", \"BMX\", \"Burrito\", \"Camper\", \"Marquis\", \"Baggage\", \"Dozer\", \"Maverick\", \"News Chopper\", \"Rancher\", \"FBI Rancher\", \"Virgo\", \"Greenwood\", \"Jetmax\", \"Hotring\", \"Sandking\", \"Blista Compact\", \"Police Maverick\", \"Boxville\", \"Benson\", \"Mesa\", \"RC Goblin\", \"Hotring Racer\", \"Hotring Racer\", \"Bloodring Banger\", \"Rancher\", \"Super GT\", \"Elegant\", \"Journey\", \"Bike\", \"Mountain Bike\", \"Beagle\", \"Cropdust\", \"Stunt\", \"Tanker\", \"RoadTrain\", \"Nebula\", \"Majestic\", \"Buccaneer\", \"Shamal\", \"Hydra\", \"FCR-900\", \"NRG-500\", \"HPV1000\", \"Cement Truck\", \"Tow Truck\", \"Fortune\", \"Cadrona\", \"FBI Truck\", \"Willard\", \"Forklift\", \"Tractor\", \"Combine\", \"Feltzer\", \"Remington\", \"Slamvan\", \"Blade\", \"Freight\", \"Streak\", \"Vortex\", \"Vincent\", \"Bullet\", \"Clover\", \"Sadler\", \"Firetruck\", \"Hustler\", \"Intruder\", \"Primo\", \"Cargobob\", \"Tampa\", \"Sunrise\", \"Merit\", \"Utility\", \"Nevada\", \"Yosemite\", \"Windsor\", \"Monster Truck\", \"Monster Truck\", \"Uranus\", \"Jester\", \"Sultan\", \"Stratum\", \"Elegy\", \"Raindance\", \"RC Tiger\", \"Flash\", \"Tahoma\", \"Savanna\", \"Bandito\", \"Freight\", \"Trailer\", \"Kart\", \"Mower\", \"Duneride\", \"Sweeper\", \"Broadway\", \"Tornado\", \"AT-400\", \"DFT-30\", \"Huntley\", \"Stafford\", \"BF-400\", \"Newsvan\", \"Tug\", \"Trailer\", \"Emperor\", \"Wayfarer\", \"Euros\", \"Hotdog\", \"Club\", \"Trailer\", \"Trailer\", \"Andromada\", \"Dodo\", \"RC Cam\", \"Launch\", \"Police Car (LSPD)\", \"Police Car (SFPD)\", \"Police Car (LVPD)\", \"Police Ranger\", \"Picador\", \"S.W.A.T. Van\", \"Alpha\", \"Phoenix\", \"Glendale\", \"Sadler\", \"Luggage Trailer\", \"Luggage Trailer\", \"Stair Trailer\", \"Boxville\", \"Farm Plow\", \"Utility Trailer\"}; public OnFilterScriptExit(){ return 1;} #else main(){} #endif public OnGameModeInit(){ return 1;} public OnGameModeExit(){ return 1;} public OnPlayerRequestClass(playerid, classid){ return 1;} public OnPlayerConnect(playerid){ return 1;} public OnPlayerDisconnect(playerid, reason){ return 1;} public OnPlayerSpawn(playerid){ return 1;} public OnPlayerDeath(playerid, killerid, reason){ if(speedmeteron[playerid] == 1) { speedmeteron[playerid] = 0; KillTimer(speedmetertimer[playerid]); HideSpeedMeter(playerid); } return 1;} public OnVehicleSpawn(vehicleid){ return 1;} public OnVehicleDeath(vehicleid, killerid){ return 1;} public OnPlayerText(playerid, text[]){ return 1;} public OnPlayerCommandText(playerid, cmdtext[]){ if (strcmp(\"/mycommand\", cmdtext, true, 10) == 0) { // Do something here return 1; } return 0;} public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){ return 1;} public OnPlayerExitVehicle(playerid, vehicleid){ if(speedmeteron[playerid] == 1) { speedmeteron[playerid] = 0; KillTimer(speedmetertimer[playerid]); HideSpeedMeter(playerid); } return 1;} public OnPlayerStateChange(playerid, newstate, oldstate){ 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){ return 1;} public OnRconLoginAttempt(ip[], password[], success){ return 1;} public OnPlayerUpdate(playerid){ if(IsPlayerInAnyVehicle(playerid)) { if(VehicleEngine[GetPlayerVehicleID(playerid)] == 0) { VehicleEngine[GetPlayerVehicleID(playerid)] = 1; speedmetertimer[playerid] = SetTimerEx(\"SpeedMeter\", 150, true, \"i\", playerid); speedmeteron[playerid] = 1; } if(VehicleEngine[GetPlayerVehicleID(playerid)] == 1) { if(speedmeteron[playerid] == 0) { speedmetertimer[playerid] = SetTimerEx(\"SpeedMeter\", 150, true, \"i\", playerid); speedmeteron[playerid] = 1; } } } 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[]){ return 1;} public OnPlayerClickPlayer(playerid, clickedplayerid, source){ return 1;} //------------SPEEDOMETER---------------------------------------------public SpeedMeter(playerid){ if(IsPlayerInAnyVehicle(playerid)) { new Float: vPos[3],Float: Speed,string[128]; new Float:health; GetVehicleHealth(GetPlayerVehicleID(playerid), health); new vehicle = GetPlayerVehicleID(playerid); new fuel = 100; // NOTE: HERE YOU PUT YOUR FUEL SYSTEM FUNCTION (instead of 100 something like Gas[GetPlayerVehicleID(playerid)] for Godfather) IF YOU WANT TO INCLUDE IT ON YOUR GAMEMODE! if(VehicleEngine[vehicle] != 1) { return 1; } if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { format(string, sizeof(string), \"%s\",VehicleName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]), TextDrawSetString(Textdraws1[playerid],string),TextDrawShowForPlayer(playerid, Textdraws1[playerid]); if(fuel <= 100 && fuel >= 90) { TextDrawSetString(Textdraws3[playerid],\"------------\"); } if(fuel <= 90 && fuel >= 80) { TextDrawSetString(Textdraws3[playerid],\"-----------\"); } if(fuel <= 80 && fuel >= 70) { TextDrawSetString(Textdraws3[playerid],\"----------\"); } if(fuel <= 70 && fuel >= 60) { TextDrawSetString(Textdraws3[playerid],\"---------\"); } if(fuel <= 60 && fuel >= 50) { TextDrawSetString(Textdraws3[playerid],\"--------\"); } if(fuel <= 50 && fuel >= 40) { TextDrawSetString(Textdraws3[playerid],\"-------\"); } if(fuel <= 40 && fuel >= 30) { TextDrawSetString(Textdraws3[playerid],\"~y~------\"); } if(fuel <= 30 && fuel >= 20) { TextDrawSetString(Textdraws3[playerid],\"~y~-----\"); } if(fuel <= 20 && fuel >= 15) { TextDrawSetString(Textdraws3[playerid],\"~y~----\"); } if(fuel <= 15 && fuel >= 10) { TextDrawSetString(Textdraws3[playerid],\"~y~---\"); } if(fuel <= 10 && fuel >= 5) { TextDrawSetString(Textdraws3[playerid],\"~y~--\"); } TextDrawShowForPlayer(playerid, Textdraws2[playerid]); TextDrawShowForPlayer(playerid, Textdraws3[playerid]); TextDrawShowForPlayer(playerid, Textdraws4[playerid]); if(!IsVehicleDrivingBackwards(GetPlayerVehicleID(playerid))) { GetVehicleVelocity(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]); Speed = floatmul(floatsqroot(floatadd(floatpower(vPos[0], 2), floatadd(floatpower(vPos[1], 2), floatpower(vPos[2], 2)))), 200); format(string, sizeof(string), \"%0.0f\", Speed), TextDrawSetString(Textdraws5[playerid], string), TextDrawShowForPlayer(playerid, Textdraws5[playerid]); if(Speed < 1) { TextDrawHideForPlayer(playerid, Textdraws0[playerid]); TextDrawSetString(Textdraws0[playerid], \"~w~R ~p~N ~w~D\"), TextDrawShowForPlayer(playerid, Textdraws0[playerid]); } if(Speed > 1) { TextDrawHideForPlayer(playerid, Textdraws0[playerid]); TextDrawSetString(Textdraws0[playerid], \"~w~R ~w~N ~p~D\"), TextDrawShowForPlayer(playerid, Textdraws0[playerid]); } return 1; } } if(IsVehicleDrivingBackwards(GetPlayerVehicleID(playerid))) { TextDrawSetString(Textdraws0[playerid], \"~p~R ~w~N ~w~D\"), TextDrawShowForPlayer(playerid, Textdraws0[playerid]); TextDrawSetString(Textdraws5[playerid], \"~r~0\"), TextDrawShowForPlayer(playerid, Textdraws5[playerid]); return 1; } } else if(speedmeteron[playerid] == 1) { speedmeteron[playerid] = 0; KillTimer(speedmetertimer[playerid]); HideSpeedMeter(playerid); } return 1;} stock IsVehicleDrivingBackwards(vehicleid) // By Joker Thank you{ new Float:Float[3]; if(GetVehicleVelocity(vehicleid, Float[1], Float[2], Float[0])) { GetVehicleZAngle(vehicleid, Float[0]); if(Float[0] < 90) { if(Float[1] > 0 && Float[2] < 0) return true; } else if(Float[0] < 180) { if(Float[1] > 0 && Float[2] > 0) return true; } else if(Float[0] < 270) { if(Float[1] < 0 && Float[2] > 0) return true; } else if(Float[1] < 0 && Float[2] < 0) return true; } return false;} public HideSpeedMeter(playerid){ TextDrawHideForPlayer(playerid, Textdraws0[playerid]); TextDrawHideForPlayer(playerid, Textdraws1[playerid]); TextDrawHideForPlayer(playerid, Textdraws2[playerid]); TextDrawHideForPlayer(playerid, Textdraws3[playerid]); TextDrawHideForPlayer(playerid, Textdraws4[playerid]); TextDrawHideForPlayer(playerid, Textdraws5[playerid]);}