Jump to content

Citizen

Moderators
  • Posts

    1,803
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Citizen

  1. You mean in *.luac ?
  2. Yeah of course begin with this script: function pedWalk(thePlayer, commandName) local pedwalk = createPed(184, 1790.5603515625, -1724.337890625, 13.5) -- I create the NPC setElementID(pedwalk,"pedwalker") -- I give him an ID setPedRotation(pedwalk,(90)) -- set his rotation local nextmarker = createMarker( 1757.421875, -1724.625, 12.55, "cylinder", 1.4, 255, 000, 000 ) -- I create the marker for the NPC addEventHandler( "onMarkerHit", nextmarker, yourFunction ) -- execute yourFunction when the marker is hit setElementID(nextmarker,"mf2")-- all my markers for the NPC have an ID like this mf1, mf2, mf3, ... mf495 ^^ setPedAnimation(pedwalk, "ped", "WALK_civi", -1, 1, 1, 0) -- The ped walk now end addCommandHandler( "testAI", pedWalk, false, false ) And if you can't find my ped take this code: function gotToPedWalker( thePlayer, commandName ) local thePed = getElementByID( "pedwalker" ) if ( thePed ) then local x, y, z = getElementPosition( thePed ) setElementPosition( thePlayer, x, y-1, z ) outputChatBox("You were teleported to the Ped Walker", thePlayer ) else outputChatBox("The Ped Walker doesn't exist !", thePlayer, 180, 0, 0 ) end end addCommandHandler( "gotoAI", gotToPedWalker, false, false ) I gonna make the video now
  3. Lol it's not simple to code an Artificial Intelligence but it's my speciality ^^ ( I very like this ) I made a NPC who can walk around LS yeah but I don't give you the code But I can explain you how I made it: This system use only the server-side ! I took the position of all angles of pavements ( I have 490 positions or something like that but I don't took everything ) and I store this positions in a database with an ID for each marker. Then I create the first marker and the NPC, and I make him walk. When he arrived to the marker, I make a random of 3 IDs of marker where he can go( only 3 because the 4th is the marker that he comes from ), I create the new marker and I set his rotation in the direction of this new marker etc... Do you understand my system ? I gonna make you a little video to show my NPC walker, today or tomorrow
  4. Try to put a setTimer( addMoreX, 50, 0 ) for move your camera mouthly in the X axis: local x, y, z, x2, y2, z2 = getCameraMatrix( thePlayer ) setCameraMatrix( x+0.5, y, z, x2, y2, z2 ) You can make an addMoreY too but you have to add 0.5 to the Y axis Try to make it and if you can't make that, I will try to make it But try first
  5. The table is "tableOut" in the server-side Solidsnake ^^ I will see your system later SoundWave 'cause I'm not at home.
  6. I think that he uses a bindKey to detect if the player go back to the menu And before he replaced his background of the menu by a transparent image manually So when the player press the key, he starts the function which move the camera.
  7. Maybe you have two times the same function in your code. Make a search with "function myStats2" and "function myStats"
  8. Yeah I forgot the return thanks The Kid but I forgot another in the line 2 The full code function setCash ( sourcePlayer,cmd,who,amount) if ( not who and not amount ) then outputChatBox("*Use /setcash [Name] [amount]", sourcePlayer, 180, 0, 0 ) return end local gived = getPlayerFromName ( who ) if not gived then outputChatBox("The player "..who.." is not connected", sourcePlayer, 180, 0, 0 ) return end account = getPlayerAccount(gived) if not isGuestAccount ( account ) then local playerCash = getAccountData ( account, "data.cash" ) local success = setAccountData ( account, "data.cash", tonumber(playerCash)+tonumber(amount) ) if success then outputChatBox ( "Your cash has been setted.", gived ) outputChatBox ( "You've setted his cash.", sourcePlayer ) else outputChatBox("ERROR: His cash his not setted", sourcePlayer, 180, 0, 0 ) end end end addCommandHandler ( "setcash", setCash ) Try this
  9. Like this: function setCash ( sourcePlayer,cmd,who,amount) if ( not who and not amount ) then outputChatBox("*Use /setcash [Name] [amount]", sourcePlayer, 180, 0, 0 ) end local gived = getPlayerFromName ( who ) if not gived then outputChatBox("The player "..who.." is not connected", sourcePlayer, 180, 0, 0 ) end account = getPlayerAccount(gived) if not isGuestAccount ( account ) then local playerCash = getAccountData ( account, "data.cash" ) local success = setAccountData ( account, "data.cash", tonumber(playerCash)+tonumber(amount) ) if success then outputChatBox ( "Your cash has been setted.", gived ) outputChatBox ( "You've setted his cash.", sourcePlayer ) else outputChatBox("ERROR: His cash his not setted", sourcePlayer, 180, 0, 0 ) end end end addCommandHandler ( "setcash", setCash ) No problem bartje01
  10. I made some modifications test it please: function setCash ( sourcePlayer,cmd,who,amount) if ( not who and not amount ) then outputChatBox("*Use /setcash [Name] [amount]", sourcePlayer, 180, 0, 0 ) end local gived = getPlayerFromName ( who ) if not gived then gived = sourcePlayer end account = getPlayerAccount(gived) if not isGuestAccount ( account ) then local playerCash = getAccountData ( account, "data.cash" ) local success = setAccountData ( account, "data.cash", tonumber(playerCash)+tonumber(amount) ) if success then outputChatBox ( "Your cash has been setted.", gived ) outputChatBox ( "You've setted his cash.", sourcePlayer ) else outputChatBox("ERROR: His cash his not setted", sourcePlayer, 180, 0, 0 ) end end end addCommandHandler ( "setcash", setCash ) It works perfectly in my brain
  11. You forgot the end: function NextMap(map) executeCommandHandler("nextmap", source, map) end addEvent("buyMap", true) addEventHandler("buyMap", getRootElement(),NextMap)
  12. A little tutorial about this function: http://lua-users.org/wiki/PatternsTutorial
  13. Oh ok I understand now And I have a question at this line: if not gived then gived = sourcePlayer The end is not compulsory ? if not gived then gived = sourcePlayer end
  14. So it's the client who update the position for his player. I like that ! ^^ so the server does almost anything. Very good idea Einheit-101 make your system by this way
  15. Why you try to getPlayerAccount with the PlayerName ?? You have to specify the playerElement, not his name so replace this: if not isGuestAccount ( getPlayerAccount ( gived ) ) then by this: if not isGuestAccount ( getPlayerAccount ( sourcePlayer) ) then And this: account = getPlayerAccount(gived) by this: account = getPlayerAccount(sourcePlayer) and it should work now The wiki is your friend ! ( I never used this function and I just saw the wiki and I found this: thePlayer: The player element you want to get the account of. )
  16. Just 40-80$...? I've made my own RPG script on SA-MP and I can say that it isn't easier to make it on lua I don't agree, for me lua it's easier than pwn and when you miss a ; at only 1 line, when you compil it, it says 26 or 36 errors ( IDK ) and never the correct line but mta no needs any compilation and most of all it says that you missed a ) ( for exemple ) and where It's easier than pwn but it's difficult and it take a very long time ( I started my French RPG with Famas in November 2009 and it's not finished ! )
  17. Citizen

    Alpha Set :D

    No I don't have skype because I have some problems with my Network when I call a guy. But I have mumble with a local server ( if you want to speak in your mic ) and msn ( see my profile )
  18. I understood but we don't want that only one update from one client, but we want an update every frames and this update start when a player tape a command. So each client update his table of position x, y, z in a onClientRender ( it's ok ) Then we want that the server get the table of position from all client every... hum I don't know but we want less than 50 milliseconds So how do you make that unless a lot of triggerBlablaEvent per seconds ?
  19. Citizen

    Alpha Set :D

    have you see this on the wiki ? I think it's because the internal clock of the server is maybe 50 ms ? So 1 cycle = 50 ms But I'm not sure ^^
  20. Oh I like this system but how do you call this function ? Because in server side, there are no onServerRender or something like that and a timer of 50 ms is not enough fast for update the position of the object lol and it's Citizen
  21. Yeah try with this: function myCash ( thePlayer, commandName ) local cash = getElementData ( thePlayer, "data.cash" ) outputChatBox ( "Your cash is: " .. tostring( cash ), thePlayer ) end addCommandHandler ( "cash", myCash ) And tell me the result.
  22. Replace by this ?: function myCash ( thePlayer, commandName ) local cash = getElementData ( thePlayer, "data.cash" ) outputChatBox ( "Your cash is: " .. tostring( cash ), thePlayer ) end addCommandHandler ( "cash", myCash ) If you have this message again "Your cash is: false" it's because this elementData doesn't exist for this player
  23. Citizen

    Music

    LOOOL my bad ^^ I didn't see that
×
×
  • Create New...