
manuelhimmler
Members-
Posts
49 -
Joined
-
Last visited
Everything posted by manuelhimmler
-
ok thanks community, i thought it would be shorter than write everything like name, type in " "! But thanks!
-
The experience was in LUA...
-
I wanted many player-values to write in such variables, like setElementData(player,"player.health",100), but better an shorter is PlayerInfo[player][health]=100
-
Thanks but instead of 1 should be a player or something and I have the experience, that I can't define an array in a function
-
Hello script-whizes! How to use this PWN-Code in LUA? enum vehs { model, ccolor1, ccolor2, }; new cvehicle[MAX_VEHICLES][vehs] For Example in PWN I can write something in these varables: cvehicle[2][model] cvehicle[2][ccolor1] cvehicle[2][ccolor2] Instead of 2 i can change it to any vehicleid under the maximum (MAX_VEHICLES) I would to load something from MYSQL in such variables, but I don't know to define them, here i give an example how I wanted to use such variables: PlayerInfo[player][health] PlayerInfo[player][level] ... Please help me.
-
How to Create Double-Arrays Like Array[1][2]?
manuelhimmler replied to manuelhimmler's topic in Scripting
This works, but if I don't write the variabe definition in a function, there comes an error "attemt to index global "testaray" Edit: OK Sorry this error is only if I write the outputDebugstring in the game by runcode resource. Thanks at all! -
How to Create Double-Arrays Like Array[1][2]?
manuelhimmler replied to manuelhimmler's topic in Scripting
I also thought so, but this isn't right! -
Hi Community? I tried to create double arrays for more than a hour and i failed, I hope you can help me. I wanted to write this PAWN-Code in LUA: new Float:Hospitals[8][4] = { {1634.4591,1768.1781,10.8203,270.0}, {1225.4983,308.7397,19.7472,157.0}, {-2655.7307,636.2322,14.4531,188.0}, {1174.2993,-1323.4747,14.7891,270.0}, {2027.4967,-1406.1840,17.2150,191.0}, {-2119.7444,-2388.7043,30.6250,55.0}, {-316.1642,1054.7610,19.7422,354.0}, {-1514.6053,2523.7820,55.8071,0.0} };
-
setCameraTarget can't be the soplution because this is the command I use in my script. And the camera looks to north. Maybe it's a problem that the player is in the near of a wall (3-5 steps).
-
Thanks, this was the solution, and @ all other: Why should the player hack to kick himself?
-
How can I set the camera behind the player and not to north?
-
My Gamemode-Ressource is MTARL, but it can't access to kickPlayer, why? Part of acl.xml: <group name="Admin"> <acl name="Moderator" /> <acl name="SuperModerator" /> <acl name="Admin" /> <acl name="RPC" /> <object name="resource.mtarl" /> <object name="user.Manuel1948" /> <object name="resource.admin" /> <object name="resource.guieditor" /> <object name="resource.webadmin" /> <object name="user.Silvercorn" /> </group> Part of Client Script: function callServerFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end triggerServerEvent("onClientCallsServerFunction", root, funcname, unpack(arg)) end function FalsePassword(IP) falselogins=falselogins + 1 RefreshInfobox("Falsches Passwort! Noch "..(3-falselogins).." Versuche.") if falselogins == 3 then hideLoginGUI() outputChatBox("[AutoKick] 3 mal falsches Passwort",0,255,255) callServerFunction("kickPlayer",source,nil,"3 mal falsches Passwort") end end addEvent("FalsePassword",true) addEventHandler("FalsePassword", getLocalPlayer(),FalsePassword) Part of Server Script: function callServerFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onClientCallsServerFunction", true) addEventHandler("onClientCallsServerFunction", root, callServerFunction)
-
Thank you 50p! It works.
-
I only want that the functions play and gui are running if the player joins ther server. I know how i can spawn the player. I only want to playe this sound file and show a window with the picture (only for testing the commands), but thank you I tried it with onClientResourceStart and it doesn't work. Sry for my bad english .
-
Hello guys, I wanted to see, if the functions work in my Client script, but they don't. My Client Script: function play() outputChatBox("Sound") local sound = playSound("Musik/Rocco-Everybody.mp3",true) setSoundVolume(sound,1) end addEventHandler("onClientPlayerJoin", getLocalPlayer(), play) function gui() outputChatBox("GUI") local window = guiCreateWindow(0.5,0.5,0.3,0.3,"PRPG - Login",true); local picture = guiCreateStaticImage(0.5,0.5,0.5,0.3,"Bilder/radio.gif",true,window) guiSetEnabled(window,true) guiSetVisible(window,true) showCursor(true,false) end addEventHandler("onClientPlayerJoin", getLocalPlayer(), gui) and my Meta.xml: <meta> <info author="Man1993" type="gamemode" version="0.1" name="Perfect RPG" description="Reallife Gamemode" /> <script src="prpg.lua" type="server"/> <script src="prpg_c.lua" type="client"/> <file src="Musik/Rocco-Everybody.mp3"/> <file src="Bilder/radio.gif"/> </meta> Please help me and say me what I've done wrong. Thanks!!
-
@robhol: Look at my code, I've made a function (not your name,but this has no preference), the command getPlayerOccupiedVehicle in my function makes an error and this command is for get the vehicle not the player. @50p: you can look at wiki and look at addeventhandler and then you have to look at onPlayerDead or something (the event) and there you find what source is. bindkey..source is ever the player. Where I can look, when I want to know infos about a command when the wiki is totally empty,like now.
-
I have opened a posting, where I will put all my questions, because I won't create for every question a posting. I wanted to create a script, when I press K the vehicle should lock, when the player is in a vehicle and write in lockcar[player] the vehicleid (lockcar[player]=vehicle), otherwise the script should look at this variable, if it contains anything (a vehicleid), this vehicle shoul open. My script: http://pastebin.com/m22dfc61e Thanks for answers!
-
Thanks buffalo, but I've forgotten to search. I don't know why I can't use this function, it is on wiki.multitheftauto.com listed. Can anybody tell me what this "DP" means and where I can get a newer. I think I have 2.3 or 2.5, I don't know it yet.
-
Why I get an "attempt to call global 'getVehicleEngineState' (a nil value)" - error, when I use this script. I press m to start my engine but I only get an error: function engine(theplayer,key,keystate,car) if getVehicleController(car)==theplayer then setVehicleEngineState(car, not getVehicleEngineState(car)) end end function keybindson(theplayer) bindKey(theplayer,"l","down",lights,source) setVehicleOverrideLights(source,1) outputChatBox("Drücke L um das Licht einzuschalten!",playerid) bindKey(theplayer,"m","down",engine,source) setVehicleEngineState(source,false) outputChatBox("Drücke M um den Motor zu starten!",playerid) end addEventHandler("onVehicleEnter",getRootElement(),keybindson)
-
yes thanks but i've found the command before your post, i've edited my post, but i don't know why my post was not be edited.
-
thx for info withdebug window. I know that thing about nil, because I've seen this, but I didn't know what you mean with table (a function maybe). What should i test for error, when no xml file was created. BUT: Thanks, I will test the debug window!! DDo you now a command to get the VehicleID from the Player, like getPlayerVehicle(thePlayer) ?
-
What is the debugscript window i use luaedit for my scripts and where i shoul insert outputdebugstring, i am a newbie and i want ehlp, why nobody can say me,what I've done wrong
-
It is no answer for my question, but thanks. I wanted to know why my kind of script don't work. I try it now so as you said, but I don't understand small parts of the wiki. For example: maproot = getLoadedMapXMLRoot () optionsnode = xmlFindSubNode ( maproot, "options", 0 ) instructionsnode = xmlFindSubNode ( optionsnode, "instructions", 0 ) What the hell is getLoadedMapXMLRoot () , I didn't find these function. Edit: I have done it so as you said, but there are the same errors again. What a fuck. Why the file won't be created or where the file will be saved? Look at the errors: Is there another way to do it better as in my following script? The code I've taken, sry but how do you want to say me what i've done wrong when you don't know about my code : login = {} loggedin = {} register = {} registered = {} function ServerStart() accfile = xmlLoadFile("accounts2.xml") if not accfile then accfile = xmlCreateFile("accounts2.xml", "accounts") accfile = xmlLoadFile("accounts2.xml") end end addEventHandler("onResourceStart",getRootElement(),ServerStart) function ServerEnd() xmlSaveFile(accfile) xmlUnloadFile(accfile) end addEventHandler("onResourceStop",getRootElement(), ServerEnd) function join() login[source]=0 register[source]=0 outputChatBox("Hallo "..getPlayerNametagText(source)..", willkommen auf SMH!", source) local checkaccount = xmlFindSubNode(xmlFindSubNode(accfile,"accounts",0),getPlayerNametagText(playerid),0) if checkaccount then outputChatBox("Dein Account ist registriert, log dich mit /log [passwort] ein",source) login[source]=1 registered[source]=1 else outputChatBox("Dein Account ist nicht registriert, registriere dich mit /reg [passwort]",source) register[source]=1 end end addEventHandler("onPlayerJoin",getRootElement() ,join) function LoginPlayer(playerid,command,password) if(login[playerid] ~= 1) then outputChatBox("Dein Account ist nicht registriert, registriere dich mit /reg [passwort]",source) else if(loggedin[playerid]==1) then outputChatBox("Du bist schon eingeloggt!",playerid) else if(password==nil) then outputChatBox("Verwendung: /log [passwort]",playerid) else local nametag=xmlFindSubNode(xmlFindSubNode(accfile,"accounts"),getPlayerNametagText(playerid),0) if(password==xmlNodeGetValue(xmlFindSubNode(nametag,"password",0))) then local x = tonumber(xmlNodeGetValue(xmlFindSubNode (nametag,"x",0))) local y = tonumber(xmlNodeGetValue(xmlFindSubNode (nametag,"y",0))) local z = tonumber(xmlNodeGetValue(xmlFindSubNode (nametag,"z",0))) local angle = tonumber(xmlNodeGetValue(xmlFindSubNode (nametag,"angle",0))) local interior = tonumber(xmlNodeGetValue(xmlFindSubNode (nametag,"interior",0))) local money = tonumber(xmlNodeGetValue(xmlFindSubNode (nametag,"money",0))) local skin = tonumber(xmlNodeGetValue(xmlFindSubNode (nametag,"skin",0))) spawnPlayer(playerid,x,y,z,angle,skin,interior) fadeCamera(playerid, true) setCameraTarget(playerid, playerid) outputChatBox("Login erfolgreich!",playerid) loggedin[playerid]=1 else outputChatBox("Falsches Passwort!",playerid) end end end end end addCommandHandler("log", LoginPlayer) function RegisterPlayer(playerid,command,password) if(register[playerid] ~= 1) then outputChatBox("Dein Account ist schon registriert, log dich mit /log [passwort] ein",source) else if(registered[playerid]==1) then outputChatBox("Du bist schon registriert!",playerid) else if(password==nil) then outputChatBox("Verwendung: /reg [passwort]",playerid) else local account = xmlCreateSubNode(accfile,getPlayerNametagText(playerid)) local x = xmlCreateSubNode(account,"x") local y = xmlCreateSubNode(account,"y") local z = xmlCreateSubNode(account,"z") local angle = xmlCreateSubNode(account,"angle") local interior = xmlCreateSubNode(account,"interior") local skin = xmlCreateSubNode(account,"skin") local money = xmlCreateSubNode(account,"money") local bankmoney = xmlCreateSubNode(account,"bankmoney") xmlNodeSetValue(x, "367.7049") xmlNodeSetValue(y, "-61.7833") xmlNodeSetValue(z, "1001.5151") xmlNodeSetValue(angle, "180") xmlNodeSetValue(interior, "10") xmlNodeSetValue(money,"5000") xmlNodeSetValue(bankmoney,"50000") xmlNodeSetValue(skin,"0") xmlSaveFile(accfile) outputChatBox("Registrierung erfolgreich (Passwort: "..password.."), log dich mit /log [passwort] ein!",playerid) registered[playerid]=1 login[playerid]=1 end end end end addCommandHandler("reg", RegisterPlayer)
-
First of all, sorry for my bad english. I am a newbie in lua scripting! I have read the tutorial but I haven't understood the xml-functions. Can anybody help me in my script and can tellme what I've done wrong by the xml-commands? login = {} loggedin = {} register = {} registered = {} function join() login[source]=0 register[source]=0 outputChatBox("Hallo "..getPlayerNametagText(source)..", willkommen auf SMH!", source) local accfile = xmlLoadFile("/accounts/"..getPlayerNametagText(source)..".xml",getPlayerNametagText(source)) if accfile then outputChatBox("Dein Account ist registriert, log dich mit /log [passwort] ein",source) login[source]=1 registered[source]=1 else outputChatBox("Dein Account ist nicht registriert, registriere dich mit /reg [passwort]",source) register[source]=1 end end function LoginPlayer(playerid,command,password) if(login[playerid] ~= 1) then outputChatBox("Dein Account ist nicht registriert, registriere dich mit /reg [passwort]",source) else if(loggedin[playerid]==1) then outputChatBox("Du bist schon eingeloggt!",playerid) else if(password==nil) then outputChatBox("Verwendung: /log [passwort]",playerid) else local accfile = xmlLoadFile("/accounts/"..getPlayerNametagText(playerid)..".xml") if(password==xmlNodeGetValue(xmlFindSubNode (accfile,"password",0))) then local x = tonumber(xmlNodeGetValue(xmlFindSubNode (accfile,"x",0))) local y = tonumber(xmlNodeGetValue(xmlFindSubNode (accfile,"y",0))) local z = tonumber(xmlNodeGetValue(xmlFindSubNode (accfile,"z",0))) local angle = tonumber(xmlNodeGetValue(xmlFindSubNode (accfile,"angle",0))) local interior = tonumber(xmlNodeGetValue(xmlFindSubNode (accfile,"interior",0))) local money = tonumber(xmlNodeGetValue(xmlFindSubNode (accfile,"money",0))) local skin = tonumber(xmlNodeGetValue(xmlFindSubNode (accfile,"skin",0))) xmlUnloadFile(accfile) spawnPlayer(playerid,x,y,z,angle,skin,interior) fadeCamera(playerid, true) setCameraTarget(playerid, playerid) outputChatBox("Login erfolgreich!",playerid) loggedin[playerid]=1 else outputChatBox("Falsches Passwort!",playerid) end end end end end addCommandHandler("log", LoginPlayer) function RegisterPlayer(playerid,command,password) if(register[playerid] ~= 1) then outputChatBox("Dein Account ist schon registriert, log dich mit /log [passwort] ein",source) else if(registered[playerid]==1) then outputChatBox("Du bist schon registriert!",playerid) else if(password==nil) then outputChatBox("Verwendung: /reg [passwort]",playerid) else local accfile = xmlCreateFile("/accounts/"..getPlayerNametagText(playerid)..".xml") local x = xmlCreateSubNode(accfile,"x") local y = xmlCreateSubNode(accfile,"y") local z = xmlCreateSubNode(accfile,"z") local angle = xmlCreateSubNode(accfile,"angle") local interior = xmlCreateSubNode(accfile,"interior") local skin = xmlCreateSubNode(accfile,"skin") local money = xmlCreateSubNode(accfile,"money") local bankmoney = xmlCreateSubNode(accfile,"bankmoney") xmlNodeSetValue("x", "367.7049") xmlNodeSetValue("y", "-61.7833") xmlNodeSetValue("z", "1001.5151") xmlNodeSetValue("angle", "180") xmlNodeSetValue("interior", "10") xmlNodeSetValue("money","5000") xmlNodeSetValue("bankmoney","50000") xmlNodeSetValue("skin","0") xmlSaveFile(accfile) xmlUnloadFile(accfile) outputChatBox("Registrierung erfolgreich (Passwort: "..password..", log dich mit /log [passwort] ein!",playerid) registered[playerid]=1 login[playerid]=1 end end end end addCommandHandler("reg", RegisterPlayer) function dead() Sleep(5000) local x = 1959.55 local y = -1714.46 local z = 12 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) end addEventHandler("onPlayerJoin", getRootElement(), join) addEventHandler("onPlayerWasted", getRootElement(), dead) function Vehicle(playerid,command,vehicleid) local vid = tonumber(vehicleid) local x,y,z = getElementPosition(playerid) x = x + 5 local createdvehicle = createVehicle(vid,x,y,z) if (createdvehicle == false) then if(vehicleid == "") then outputChatBox("Die VehicleID ".. vid .." gibt es nicht.",playerid) else outputChatBox("Verwendung: /veh [vehicleid] (400-611)",playerid) end else outputChatBox("Fahrzeug mit der ID ".. vid .." wurde gespawnt.",playerid) end end addCommandHandler("veh", Vehicle) The Errors in the console are bad arguments in every xml-function exceptly the first.