AHMED MOSTAFA Posted April 24, 2017 Share Posted April 24, 2017 Hello guys ... I will explain something important about code First [ when you ask for help, how do other help you? ] Like [ Help: how i can create an ped ? ] [ For example ] someone will write that .. -- You can use this code createPed did you understand anything ? ..................................................................................................... ..................................................................................................... ..................................................................................................... givePlayerMoney -- blue getPlayerAccount -- yellow playSound -- red At the first of explaining these codes you should know thatThe script consists of three filesmeta.xml client.lua server.lua for more information about meta.xml click here Of course, it is known that the meta.xml file is the main file in the script there is no meta.xml file, there is no script !!what about [ client file ] and [ server file ] There are special codes for Client file and special code for server file and special codes for client file and server file[ For Example ] playSound -- red red code [ for client file ] getPlayerAccount -- yellow yellow code [ for server file ] givePlayerMoney -- blue blue code [ for server file or client file ]I have not yet taken advantage of the code and how can I bring an example?Simply if the code already exists you can just click on itThe browser will take you directly to the wiki page You will find both ..Detailed explanation of the codeOne example or more how you can know if this code for client file or server file or it [ Shared ] ?you will findClient-only function orServer-only function orShared function where are these words ?Look at this picture Now is the time to explain the important stuff If you click on this code [ For Example ] playSound -- client only That will open page like this Look at this picture [ For Example ] getPlayerAccount -- server only -- and getAccountName -- server only Of course, you will open a page with an explanation and examples and others........................................................... how you can create an function ??This depends on the code you want to create for it[ For Example .. the previous code ] getPlayerAccount will be function test () acc = getPlayerAccount ( thePlayer ) end -- test: the name of the function -- thePlayer: that you want to get his account what about the "event" and the function of "event" ? -- Ex "onClientPlayerWasted" "onPlayerWasted" "onPlayerJoin" Of course, that will open page on your browser with [ Example, explained, and other ] what is meant of source ?source: This is the element that the event originated from.[ For Example ] the source in this "event" is the player who wasted "onPlayerWasted" [ For Example ] the source in this "event" is the vehicle that was blown up "onVehicleExplode" okay ... explain the event as follows create the "event" and the function and the argumnts [ For Example ] function killerProject ( _, killer, killerweapon ) if killer then if getElementType ( killer ) == "player" then outputChatBox ( " [ the killer "..getPlayerName(killer).." killer weapon "..killerweapon.." ] ", source ) end end end addEventHandler ( "onPlayerWasted", root, killerProject ) --[[ killer: an element representing the player or vehicle who was the killer. If there was no killer this is false. killerweapon: an integer representing the killer weapon or the damage type. The source of this event is the player that died or got killed. --]] where did you get these codes from ?killerweapon and killer and sourceLook at this picture how you can know if this event for client file or server file ? when you click on the "event"you will find Clientside eventorServerside event the first word [ Clientside event ] Indicate client file the second word [ Serverside event ] Indicate server file where are these words ?Look at this picture ...................................................................................................................... my english is bad ...................................................................................................................... تم شرح هذا الموضوع باللغة العربية 3 Link to comment
Recommended Posts