^Dev-PoinT^ Posted November 20, 2011 Posted November 20, 2011 Hi all its work fine but the msg dont show You Have Picked up a .. function Health ( totalammo, killer, killerweapon, bodypart ) local x, y, z = getElementPosition ( source ) local health = createPickup ( x, y, z, 0, 40) addEventHandler("onPickupHit", health, Health) end addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) function Health (thePlayer) setElementHealth(thePlayer,tonumber(getElementHealth(thePlayer))+tonumber(getPickupAmount(source))) destroyElement(source) end function onPickupHitShow ( thePlayer ) local a = getPickupType ( source ) if (a == 0) then outputChatBox(.. a " You Have Picked up.. ", thePlayer ), getRootElement(), 255, 255, 0, true) addEventHandler ( "onPickupHit", getRootElement(), onPickupHitShow ) i tryed over 10 time fix it but always get an errors
mjau Posted November 20, 2011 Posted November 20, 2011 ok lol you pmed me with this and i fixed the shit wich was wrong so it worked then you got a problem with the msg and gave me the debug error and it said unexpected sysmbol at line 16 so i said just go to line 16 and look you will find the symbol wich shouldnt be there i guess
^Dev-PoinT^ Posted November 20, 2011 Author Posted November 20, 2011 iam not good scripter like you are iam new in script i have errors in the smallest scripts like outputChatBox and colors and .... so if you can help me with it please stand there and do nothing
CapY Posted November 20, 2011 Posted November 20, 2011 Honestly, you are stupid as hell, these kind of errors are so easy to fix.(I didn't readed the whole code anyway) From thePlayer ) to thePlayer
mjau Posted November 20, 2011 Posted November 20, 2011 Lol he is not stupid as hell but yeh as far i can see what CapY posted is right
CapY Posted November 20, 2011 Posted November 20, 2011 Lol he is not stupid as hell Then he's just lazy to fix simple errors.
mjau Posted November 20, 2011 Posted November 20, 2011 He just need to learn and dont call him stupid cuz stupid as hell when i hear that i think of people who dont know how to open a door lolz but anyway thisn is going offtopic dev feel free to pm me again if you need help
TAPL Posted November 20, 2011 Posted November 20, 2011 outputChatBox(.. a " You Have Picked up.. ", thePlayer ), getRootElement(), 255, 255, 0, true) Dev Point what do you think about this? there are 3 errors can you see it?
Maurize Posted November 20, 2011 Posted November 20, 2011 outputChatBox( " You Have Picked up a ".. [here your variable for type], thePlayer, getRootElement(), 255, 255, 0 )
TAPL Posted November 20, 2011 Posted November 20, 2011 outputChatBox( " You Have Picked up a ".. [here your variable for type], thePlayer, getRootElement(), 255, 255, 0 ) wrong wrong wrong wrong wrong wrong wrong wrong wrong wrong wrong wrong wrong
12p Posted November 20, 2011 Posted November 20, 2011 ReturnsReturns ''false'' if the pickup is invalid, or an integer of the type of the pickup, which include: 0: Health pickup 1: Armour pickup 2: Weapon pickup Now you can see the error. Fix it, gogogo!
unknooooown Posted November 21, 2011 Posted November 21, 2011 i dont get you Benxamix2 Joined: Sun Oct 02, 2011 7:33 am Total posts: 258 | Search user’s posts (0.08% of all posts / 5.16 posts per day) That pretty much says it all doesn't it?
TAPL Posted November 21, 2011 Posted November 21, 2011 Dev point, you still didn't find out what the error? what the hell you did the same error before viewtopic.php?f=91&t=36974&p=380925#p380899 and Solidsnake say that you are using two arguments to who output the message You never learning from what people fix for you https://wiki.multitheftauto.com/wiki/OutputChatBox
Kenix Posted November 21, 2011 Posted November 21, 2011 Try function Health ( totalammo, killer, killerweapon, bodypart ) local x, y, z = getElementPosition ( source ) local health = createPickup ( x, y, z, 0, 40) addEventHandler("onPickupHit", health, Health) end addEventHandler ( "onPlayerWasted", root, createDeathPickup ) function Health ( thePlayer ) setElementHealth( thePlayer,tonumber(getElementHealth(thePlayer))+tonumber(getPickupAmount(source)) ) destroyElement( source ) end function onPickupHitShow ( thePlayer ) local a = getPickupType ( source ) if a == 0 then outputChatBox( a.." You Have Picked up.. ", thePlayer , root, 255, 255, 0, true ) end end addEventHandler ( "onPickupHit", root, onPickupHitShow )
TAPL Posted November 21, 2011 Posted November 21, 2011 Kenix, you too did the same thing >< wtf? outputChatBox( a.." You Have Picked up.. ", thePlayer , root, 255, 255, 0, true ) wtf is this? thePlayer , root omg noobs
AGENT_STEELMEAT Posted November 21, 2011 Posted November 21, 2011 There is no 'createDeathPickup' function defined. The function 'Health' is defined twice.
12p Posted November 21, 2011 Posted November 21, 2011 omg noobs +1 TO EVERYONE: ReturnsReturns ''false'' if the pickup is invalid, or an integer of the type of the pickup, which include: 0: Health pickup 1: Armour pickup 2: Weapon pickup This says that we cannot use getPickupType as a string, because it returns A NUMBER. So to show it properly you must use tostring(a) To show you this text on chat: "You have picked up a 0". But it's still wrong, right? Using tables you can set the number mean "something". names = { [0]="something", [1]="anotherThing", [2]="andSomethingElse" } So it will show "You have picked up a something" in the case of a health pickup. Now, go fix it! ALSO WHAT MICHAEL SAID RIGHT ABOVE ME. CHECK IT PD. I think dev needs seriously to FOCUS ON WHAT HE'S DOING. His script is completely nonsense.
AGENT_STEELMEAT Posted November 21, 2011 Posted November 21, 2011 13 lines - 5 minute script. Read the comments. --This function is executed when the health pickup is used - it destroys the pickup. --NOTE: there is no need to call setElementHealth as pickups handle this automatically. local function onHealthPickupUse(thePlayer) destroyElement(source) end --This function is executed when a player dies - it creates a health pickup where they died. local function playerDeath() local posX, posY, posZ = getElementPosition(source) local healthPickup = createPickup(posX, posY, posZ, 0, 40) addEventHandler("onPickupUse", healthPickup, onHealthPickupUse) end addEventHandler("onPlayerWasted", root, playerDeath)
CapY Posted November 21, 2011 Posted November 21, 2011 Don't you understand he will not read any of these lines, he will just copy/paste it.
AGENT_STEELMEAT Posted November 21, 2011 Posted November 21, 2011 Regardless of whether or not someone will listen, I always give proper advice.
Kenix Posted November 22, 2011 Posted November 22, 2011 (edited) Kenix, you too did the same thing ><wtf? outputChatBox( a.." You Have Picked up.. ", thePlayer , root, 255, 255, 0, true ) wtf is this? thePlayer , root omg noobs oh I did not notice it. all can be wrong. This correct local tPickups = { -- table Pickups type [0] = "Health", [1] = "Armour", [2] = "Weapon" } addEventHandler ( "onPlayerWasted", root, -- add handler if player die function( totalammo, killer, killerweapon, bodypart ) local x, y, z = getElementPosition ( source ) -- get position "die player" local health = createPickup ( x, y, z, 0, 40 ) -- it's create health pickup in position die player.. addEventHandler( "onPickupHit", health, -- add handler if Pickup Hit function ( thePlayer ) -- thePlayer is player, source is pickup outputChatBox( " You Have Picked up.. "..tPickups[ getPickupType ( source ) ], thePlayer, 255, 255, 0, true ) -- print it destroyElement( source ) -- destroy Pickup end ) end ) Edited November 22, 2011 by Guest
^Dev-PoinT^ Posted November 22, 2011 Author Posted November 22, 2011 Thx Kenix So mutch i will study your code
unknooooown Posted November 22, 2011 Posted November 22, 2011 Thx Kenix So mutch i will study your code Thats what I like to see ^Dev-PoinT^!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now