Jump to content

Need help again with lua


Guest Redsoxx

Recommended Posts

I need help with this script I made i dont get the errors messages but here it go thx again

addEventHandler ( "onPlayerJoin", "onPlayerJoin" ) 
function onPlayerJoin ( id ) 
        sendMessage ( id, "Welcome to Red's Rpg Most of the scripts are in lua" ) 
        end 
  
function iif ( cond, arg1, arg2 ) 
    if ( cond ) then 
        return arg1 
    end 
    return arg2 
end 
addEventHandler ( "onPlayerChat", "onPlayerChat" ) 
function onPlayerChat ( id, text ) 
    local command = gettok ( text, 0, " " ) 
    local player = iif ( gettok ( text, 1, " " ), getPlayer ( gettok ( text, 1, " " ) ), id ) 
if ( command == "!info" ) then 
        sendChat ( "Red's Basic Lua Rpg Script" ) 
        elseif ( command == "!drugs" ) then 
        sendChat ( "The list of drugs are: Coke,Heroin,weed," ) 
        elseif ( command == "!buycoke" ) then 
        sendChat ( getPlayerName ( player ) "Has just bought coke" ) 
        elseif ( command == "!buyheroin" ) then 
        sendChat ( getPlayerName ( player ) "Has just bought Heroin" ) 
        elseif ( command == "!buyweed" ) then 
        sendChat ( getPlayerName ( player ) "Has just bought weed" ) 
        end 
        end 
end 
addEventHandler ( "onAdminChat", "onAdminChat" ) 
function onAdminChat ( id, text ) 
local command = gettok ( text, 0, " " ) 
    local player = iif ( gettok ( text, 1, " " ), getPlayer ( gettok ( text, 1, " " ) ), id ) 
    if ( command == "!slap" ) then 
    sendChat ( slapPlayer ( id ) "You have been slapped by an admin" ) 
    end  
end  

Link to comment
This is not place for LUA scripting... Please post this to proper place.

This is right the place.. Where does it say this is only for mirc scripts?...

addEventHandler ( "onPlayerJoin", "onPlayerJoin" ) 
function onPlayerJoin ( id ) 
    sendMessage ( id, "Welcome to Red's Rpg Most of the scripts are in lua" ) 
end 
  
function iif ( cond, arg1, arg2 ) 
    if ( cond ) then 
        return arg1 
    end 
    return arg2 
end 
addEventHandler ( "onPlayerChat", "onPlayerChat" ) 
function onPlayerChat ( id, text ) 
    local command = gettok ( text, 0, " " ) 
    local player = iif ( gettok ( text, 1, " " ), getPlayer ( gettok ( text, 1, " " ) ), id ) 
    if ( command == "!info" ) then 
        sendChat ( "Red's Basic Lua Rpg Script" ) 
    elseif ( command == "!drugs" ) then 
        sendChat ( "The list of drugs are: Coke,Heroin,weed," ) 
    elseif ( command == "!buycoke" ) then 
        sendChat ( getPlayerName ( player ) "Has just bought coke" ) 
    elseif ( command == "!buyheroin" ) then 
        sendChat ( getPlayerName ( player ) "Has just bought Heroin" ) 
    elseif ( command == "!buyweed" ) then 
        sendChat ( getPlayerName ( player ) "Has just bought weed" ) 
    end 
end 
  
addEventHandler ( "onAdminChat", "onAdminChat" ) 
function onAdminChat ( id, text ) 
local command = gettok ( text, 0, " " ) 
    local player = iif ( gettok ( text, 1, " " ), getPlayer ( gettok ( text, 1, " " ) ), id ) 
    if ( command == "!slap" ) then 
        sendChat ( slapPlayer ( id ) "You have been slapped by an admin" ) 
    end  
end  

looks like you're interested in the thing, will release an update today or tomorrow, have some things fixed.

Link to comment
This is not place for LUA scripting... Please post this to proper place.

This is right the place.. Where does it say this is only for mirc scripts?...

the actual place for lua scripts is the scripting section under MTA:San Andreas, this is a section for add-ons, i.e. mIRC scripting, lua scripting is built into MTA so it has its own section

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...