Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

[Tutorial] Global commands

Vetor3x1

Anfänger
Hello peeps,

this is small tutorial if you wanna use old commands as !points, !cash, !stats ....

if (string.find(message,"something")) - this is condition if you write text with "something" for example !something it gonna do some function

and not (string.find(message," something")) then - This is an exception, if you write something with a space before n, the script will continue

Example 1

Code:
addEventHandler ("onPlayerChat",getRootElement(),
function(message,type)
if (string.find(message,"!cash")) and not (string.find(message," !cash")) then

----some functions

end -- Close condition
end -- Close function
)
Example 2

Code:
addEventHandler ("onPlayerChat",getRootElement(),
function(message,type)
     if (string.find(message,"!cash")) and not (string.find(message," !cash")) then

--function

elseif (string.find(message,"!stats")) and not (string.find(message," !stats")) then -- Is possible to add more condition's

--functions

end -- Close condition
end -- Close function
)
Example 3

Code:
addEventHandler ("onPlayerChat",getRootElement(),
function(message,type) -- Function
if (string.find(message,"!points")) and not (string.find(message," !points")) then -- Our condition
local player = getPlayerName (source)
local points = getPlayerPoints(source)
outputChatBox("#ffffff" .. player .. " #ffffffhas " .. points .. "  points", getRootElement(), 255, 0, 0,true ) -- Message to chat
end -- Close function
end -- Close condition
)
Hope it gonna help someone (:

 
Back
Top