- Thread Author
- #2
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
Example 2
Example 3
Hope it gonna help someone 
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
)
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
)
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
)