Vetor3x Posted October 2, 2014 Report Share Posted October 2, 2014 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 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 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 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 (: Link to comment Share on other sites More sharing options...
Recommended Posts