Hilfe: Weiß nicht weiter
- russkiJ.
- Geschlossen
- Erledigt
Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!
Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
-
-
So, ich habe jetzt mal einen groben Blick drüber geworfen und die Änderungen gemacht.
Versuche es so: (kompilieren kann ich es momentan nicht):C
Alles anzeigen//INCLUDES #include <a_samp> #include <YSI\y_ini> //DEFINES #define DIALOG_REGISTER 1 #define DIALOG_LOGIN 2 #define DIALOG_ERFOLGREICH_1 3 #define DIALOG_ERFOLGREICH_2 4 #define PATH "/users/%s.txt" //FARBEN #define WHITE 0xFFFFFF #define ROT 0xFF0000 #define GRUEN 0x00FF00 #define BLAU 0x0D00FF #define ORANGE 0xFF9100 //EINGEBETTETE FARBEN #define COL_WHITE "{FFFFFF}" #define COL_RED "{FF0000}" #define COL_GREEN "{00FF00}" #define COL_LIGHTBLUE "{0095FF}" new Fahrzeugname[][] = { "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", "RC Van", "Skimmer", "PCJ-600", "Roller", "Freeway", "RC Baron", "RC Raider", "Glendale", "Oceanic", "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "Fahrrad", "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", "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", "Traktor", "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", "Polizeiwagen", "Polizeiwagen", "Polizeiwagen", "Cop Ranger", "Picador", "SWAT Van", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer", "Luggage Trailer", "Stair Trailer", "Boxville", "Farm Plow", "Utility Trailer" }; enum Tachosystem { Text:Tachoanzeige[13] } new Tachospeedanzeige[Tachosystem]; new Tachoaktiv[MAX_PLAYERS]; new Text:Tacho[MAX_PLAYERS][6]; new Text:Tachoautomarke[MAX_PLAYERS]; new Text:Autozustand[MAX_PLAYERS]; new motor,lichter,objektiv,boot,bonnet,doors,alarm; new bool:Motor[MAX_VEHICLES]=false; enum pInfo { pPass, pCash, pKills, pDeaths } new PlayerInfo[MAX_PLAYERS][pInfo]; main() { print("\n----------------------------------"); print(" Test Script by Dennis Lambrecht "); print("----------------------------------\n"); } //__________________________________________________________________________________ public OnGameModeInit() { SetGameModeText("BLRP"); AddPlayerClass(0, 1374.8986, -1633.0488,13.3828, 157.9723, 0, 0, 0, 0, 0, 0); AddStaticVehicle(481,1361.1169,-1633.1951,12.8977,178.5903,6,6); //------------------------------Tachozubehör------------------------------------------------ for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) { Autozustand[playerid] = TextDrawCreate(500.000000,402.000000,"Autohp:"); TextDrawLetterSize(Autozustand[playerid],0.500000,1.200000); TextDrawColor(Autozustand[playerid], -1); TextDrawSetOutline(Autozustand[playerid], 1); TextDrawUseBox(Autozustand[playerid],1); Tachoautomarke[playerid] = TextDrawCreate(500.000000,417.000000,"Marke:"); TextDrawLetterSize(Tachoautomarke[playerid], 0.500000, 1.200000); TextDrawColor(Tachoautomarke[playerid], -1); TextDrawSetOutline(Tachoautomarke[playerid], 1); TextDrawUseBox(Tachoautomarke[playerid],1); } //-------------------------------------Tacho------------------------------------------------ Tachospeedanzeige[Tachoanzeige][0] = TextDrawCreate(440.000000,400.000000,"~b~10"); Tachospeedanzeige[Tachoanzeige][1] = TextDrawCreate(430.000000,380.000000,"~b~20"); Tachospeedanzeige[Tachoanzeige][2] = TextDrawCreate(430.000000,360.000000,"~b~30"); Tachospeedanzeige[Tachoanzeige][3] = TextDrawCreate(432.000000,340.000000,"~b~40"); Tachospeedanzeige[Tachoanzeige][4] = TextDrawCreate(440.000000,320.000000,"~b~50"); Tachospeedanzeige[Tachoanzeige][5] = TextDrawCreate(460.000000,300.000000,"~b~60"); Tachospeedanzeige[Tachoanzeige][6] = TextDrawCreate(489.000000,290.000000,"~b~70"); Tachospeedanzeige[Tachoanzeige][7] = TextDrawCreate(530.000000,291.000000,"~b~80"); Tachospeedanzeige[Tachoanzeige][8] = TextDrawCreate(562.000000,304.000000,"~b~90"); Tachospeedanzeige[Tachoanzeige][9] = TextDrawCreate(580.000000,320.000000,"~b~100"); Tachospeedanzeige[Tachoanzeige][10] = TextDrawCreate(593.000000,340.000000,"~b~110"); Tachospeedanzeige[Tachoanzeige][11] = TextDrawCreate(600.000000,360.000000,"~b~120"); Tachospeedanzeige[Tachoanzeige][12] = TextDrawCreate(602.000000,379.000000,"~b~130"); for(new i; i < 13; i++) { TextDrawSetShadow(Tachospeedanzeige[Tachoanzeige][i], 1); TextDrawSetOutline(Tachospeedanzeige[Tachoanzeige][i], 0); } //------------------------------Tank und Motorsystem------------------------------------------------- ManualVehicleEngineAndLights(); for (new i=0; i< MAX_VEHICLES; i++) { GetVehicleParamsEx(i,motor,lichter,objektiv,boot,bonnet,doors,alarm); SetVehicleParamsEx(i,VEHICLE_PARAMS_OFF,lichter,objektiv,boot,bonnet,doors,alarm); Motor[i] = false; } return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 1378.4547,-1644.4020,13.5469); SetPlayerCameraPos(playerid, 1378.4547,-1644.4020,13.5469); SetPlayerCameraLookAt(playerid, 1376.8237,-1642.8486,13.3828); return 1; } public OnPlayerConnect(playerid) { Autozustand[playerid] = TextDrawCreate(500.000000,402.000000,"Autohp:"); TextDrawLetterSize(Autozustand[playerid],0.500000,1.200000); TextDrawColor(Autozustand[playerid], -1); TextDrawSetOutline(Autozustand[playerid], 1); TextDrawUseBox(Autozustand[playerid],1); Tachoautomarke[playerid] = TextDrawCreate(500.000000,417.000000,"Marke:"); TextDrawLetterSize(Tachoautomarke[playerid], 0.500000, 1.200000); TextDrawColor(Tachoautomarke[playerid], -1); TextDrawSetOutline(Tachoautomarke[playerid], 1); TextDrawUseBox(Tachoautomarke[playerid],1); if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Gebe dein Passwort ein um zu spielen!","Login","Beenden"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registrieren...",""COL_WHITE"Gebe ein Passwort ein um zu registrieren.","Registrieren","Beenden"); } return 1; } public OnPlayerDisconnect(playerid, reason) { new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Geld",GetPlayerMoney(playerid)); INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]); INI_WriteInt(File,"Tode",PlayerInfo[playerid][pDeaths]); INI_Close(File); return 1; } public OnPlayerSpawn(playerid) { SetPlayerHealth(playerid,100); SetPlayerSkin(playerid, 26); return 1; } public OnPlayerDeath(playerid, killerid, reason) { PlayerInfo[killerid][pKills]++; PlayerInfo[playerid][pDeaths]++; return 1; } public OnVehicleSpawn(vehicleid) { GetVehicleParamsEx(vehicleid,motor,lichter,objektiv,boot,bonnet,doors,alarm); SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lichter,objektiv,boot,bonnet,doors,alarm); Motor[vehicleid] = false; return 1; } stock Speed(Float:StartPosX, Float:StartPosY, &Float:NewX, &Float:NewY, Float:alpha, Float:dist) { NewX = StartPosX + (dist * floatsin(alpha, degrees)); NewY = StartPosY + (dist * floatcos(alpha, degrees)); } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/hilfe", cmdtext, true, 10) == 0) { SendClientMessage(playerid, BLAU , "James, an Stelle und Ort!"); return 1; } if (strcmp(cmdtext, "/kill", true)==0) { SendClientMessage(playerid, ROT , "Wieso bringst du dich um?"); SetPlayerHealth(playerid, 0); return 1; } if(strcmp(cmdtext, "/me", true)==0) { new str[256], sname[256]; GetPlayerName(playerid, sname, 256); format(str, 256, "%s %s", sname, cmdtext[4]); SendClientMessageToAll(0x33CCFFAA, str); return 1; } if(strcmp(cmdtext, "/heilen", true)==0) { SendClientMessage(playerid, ROT , "Der automatische Arzt war hier"); SetPlayerHealth(playerid, 100); } if(strcmp("/motor",cmdtext,true,10) == 0) { if(GetPlayerVehicleSeat(playerid) == 0) { new car = GetPlayerVehicleID(playerid); if(GetVehicleModel(car) == 481 || GetVehicleModel(car) == 510 || GetVehicleModel(car) == 509) { SendClientMessage(playerid,0xFF0000FF,"Ein Fahrrad besitzt kein Motor!"); } else if (Motor[car] == false) { GetVehicleParamsEx(car,motor,lichter,objektiv,boot,bonnet,doors,alarm); SetVehicleParamsEx(car,VEHICLE_PARAMS_ON,lichter,objektiv,boot,bonnet,doors,alarm); Motor[car] = true; GameTextForPlayer(playerid,"~w~Motor ~g~an",500,1); } else { GetVehicleParamsEx(car,motor,lichter,objektiv,boot,bonnet,doors,alarm); SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lichter,objektiv,boot,bonnet,doors,alarm); Motor[car] = false; GameTextForPlayer(playerid,"~w~Motor ~g~aus",500,1); } } } return 0; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if(GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 510) { GetVehicleParamsEx(vehicleid,motor,lichter,objektiv,boot,bonnet,doors,alarm); SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lichter,objektiv,boot,bonnet,doors,alarm); } return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER && !Tachoaktiv[playerid]) { for(new i; i < 13; i++) TextDrawShowForPlayer(playerid, Tachospeedanzeige[Tachoanzeige][i]); for(new i; i < 6; i++) Tacho[playerid][i] = TextDrawCreate(516.0,350.0, "~r~ |"); } else { for(new i; i < 6; i++) TextDrawHideForPlayer(playerid, Tacho[playerid][i]); for(new i; i < 13; i++) TextDrawHideForPlayer(playerid, Tachospeedanzeige[Tachoanzeige][i]); TextDrawHideForPlayer(playerid, Tachoautomarke[playerid]); TextDrawHideForPlayer(playerid, Autozustand[playerid]); } if(newstate == PLAYER_STATE_DRIVER) { TextDrawShowForPlayer(playerid,Tachospeedanzeige[Tachoanzeige][playerid]); TextDrawShowForPlayer(playerid,Tachoautomarke[playerid]); TextDrawShowForPlayer(playerid,Autozustand[playerid]); } 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(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && !Tachoaktiv[playerid]) { new Float:fPos[3]; new Float:Pos[6][6]; new Float:sSpeed; new string1[256]; new string2[256]; new Float:FahrzeugLeben; GetVehicleVelocity(GetPlayerVehicleID(playerid), fPos[0], fPos[1], fPos[2]); sSpeed = floatsqroot(floatpower(fPos[0], 2) + floatpower(fPos[1], 2) + floatpower(fPos[2], 2)) * 200; new Float:alpha = 320 - sSpeed; if(alpha < 70) alpha = 70; for(new i; i < 6; i++) { TextDrawHideForPlayer(playerid, Tacho[playerid][i]); TextDrawDestroy(Tacho[playerid][i]); Speed(516,350, Pos[i][0], Pos[i][1], alpha, (i + 1) * 8); Tacho[playerid][i] = TextDrawCreate(Pos[i][0], Pos[i][1], "~r~ |"); TextDrawLetterSize(Tacho[playerid][i],0.9,3.0); TextDrawSetOutline(Tacho[playerid][i], 0); TextDrawSetShadow(Tacho[playerid][i], 1); TextDrawShowForPlayer(playerid, Tacho[playerid][i]); GetVehicleHealth(GetPlayerVehicleID(i), FahrzeugLeben); if(FahrzeugLeben > 800) { format(string2,sizeof(string2),"~b~Autohp: ~y~%d%",floatround(FahrzeugLeben)); TextDrawSetString(Autozustand[i],string2); } else if(FahrzeugLeben > 500) { format(string2,sizeof(string2),"~b~Autohp: ~r~%d%",floatround(FahrzeugLeben)); TextDrawSetString(Autozustand[i],string2); } else { format(string2,sizeof(string2),"~b~Autohp: ~r~%d%",floatround(FahrzeugLeben)); TextDrawSetString(Autozustand[i],string2); } } format(string1,sizeof(string1),"~b~Marke: ~y~%s",Fahrzeugname[GetVehicleModel(GetPlayerVehicleID(playerid))-400]); TextDrawSetString(Tachoautomarke[playerid], string1); TextDrawShowForPlayer(playerid, Tachoautomarke[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[]) { switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registrierung...",""COL_RED"Du hast ein ungültiges Passwort eingegeben!\n"COL_WHITE"Gebe ein Passwort ein um zu registrieren.","Registrierung","Beenden"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Passwort",udb_hash(inputtext)); INI_WriteInt(File,"Geld",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Tode",0); INI_Close(File); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); ShowPlayerDialog(playerid, DIALOG_ERFOLGREICH_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Erfolgreich!",""COL_GREEN"Danke, du bist nun ein Teil des Servers "COL_LIGHTBLUE"BLACK LIFE ROLEPLAY","Ok",""); } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); ShowPlayerDialog(playerid, DIALOG_ERFOLGREICH_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Erfolgreich!",""COL_GREEN"Du darfst nun Spielen!","Ok",""); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Du hast ein falschen Passwort eingegeben.\n"COL_WHITE"Gebe dein Passwort ein um zu spielen!","Login","Beenden"); } return 1; } } } return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; } //====================== FUNKTIONEN ============================// forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_Int("Passwort",PlayerInfo[playerid][pPass]); INI_Int("Geld",PlayerInfo[playerid][pCash]); INI_Int("Kills",PlayerInfo[playerid][pKills]); INI_Int("Tode",PlayerInfo[playerid][pDeaths]); return 1; } stock UserPath(playerid) { new string[128],playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),PATH,playername); return string; } stock udb_hash(buf[]) { new length=strlen(buf); new s1 = 1; new s2 = 0; new n; for (n=0; n<length; n++) { s1 = (s1 + buf[n]) % 65521; s2 = (s2 + s1) % 65521; } return (s2 << 16) + s1; }
-
Vielen vielen Dank.
-
breadfish.de
Hat das Thema geschlossen.