Jump to content

help


golanu21

Recommended Posts

Posted
addEventHandler("onPlayerCommand", root, 
function (source, cmd, gunid, ammo) 
    if cmd = = "addevent" then 
        local x, y, z = getLocalPlayer (source) 
        local accName = getAccountName( getPlayerAccount(source) ) 
            if gunid and ammo then 
                if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admins" ) ) then 
                    eventmarker = createMarker (x, y, z, "cylinder", 5, 0, 0, 0, 0 ) 
                    outputChatBox ("Adminul"..accName.."a pornit un event. [/joinevent]", source, 255, 0, 0 ) 
                     else 
                        outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]", source, 255, 0, 0 ) 
                            else 
                                outputChatBox ("Tre sa fi un admin boule", source, 255, 0, 0 ) 
                                    else if cmd = = "joinevent" then 
                                        giveWeapon (source, gunid, ammo) 
                                        outputChatBox("Ai intrat in event", source, 0, 255, 0 ) 
                                        setElementPosition ( source, eventmarker ) 
                                    end 
                                end 
                            end 
                        end 
                    end 
)        

[14:49:31] SCRIPT ERROR: 3: 'then' expected near '=' 
[14:49:31] WARNING: 'then' expected near '= 

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

Posted (edited)
    if cmd == "addevent" then 

There is one space more.

Edited by Guest

Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003

  • MTA Team
Posted
addEventHandler("onPlayerCommand", root, 
function (source, cmd, gunid, ammo) 
    if cmd == "addevent" then 
        local x, y, z = getLocalPlayer (source) 
        local accName = getAccountName( getPlayerAccount(source) ) 
            if gunid and ammo then 
                if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admins" ) ) then 
                    eventmarker = createMarker (x, y, z, "cylinder", 5, 0, 0, 0, 0 ) 
                    outputChatBox ("Adminul"..accName.."a pornit un event. [/joinevent]", source, 255, 0, 0 ) 
                     else 
                        outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]", source, 255, 0, 0 ) 
                            else 
                                outputChatBox ("Tre sa fi un admin boule", source, 255, 0, 0 ) 
                                    else if cmd = = "joinevent" then 
                                        giveWeapon (source, gunid, ammo) 
                                        outputChatBox("Ai intrat in event", source, 0, 255, 0 ) 
                                        setElementPosition ( source, eventmarker ) 
                                    end 
                                end 
                            end 
                        end 
                    end 
)        

Posted

[14:59:23] SCRIPT ERROR:12: 'end' expected (to close 'if' at line 7) near 'else' 
[14:59:23] WARNING: 12: 'end' expected (to close 'if' at line 7) near 'else' 

idk where i need to put end

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

  • MTA Team
Posted

golanu. read the error.

SCRIPT ERROR:12: 'end' expected (to close 'if' at line 7) near 'else'

This means that on line 12 there is an error. read it and debug it yourself.

Posted

i type /addevent and his need to give me

outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]", source, 255, 0, 0 )

but nothing

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

  • MTA Team
Posted

X-SHADOW, don't modify your code. It spoils the nature of the forum. Make a new post.

also golanu check the code

Posted

don't work , i type, /addevent 30 100

and give me outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

Posted

Because he put getLocalPlayer and it's only ClientSide should replace with source

and there is space in joinevent .

My ingame nickname : Ops!

-DeathMatch GameMode By Ops! : 5%

Posted

this is the script man

addEventHandler("onPlayerCommand", root, 
function ( cmd, gunid, ammo) 
    if cmd == "addevent" then 
    local x, y, z = getElementPosition (source) 
        local accName = getAccountName( getPlayerAccount(source) ) 
            if gunid and ammo then 
                if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admins" ) ) then 
                    eventmarker = createMarker (x, y, z, "cylinder", 5, 0, 0, 0, 0 ) 
                    outputChatBox ("Adminul"..accName.."a pornit un event. [/joinevent]", source, 255, 0, 0 ) 
                     else 
                        outputChatBox ("Tre sa fi un admin boule", source, 255, 0, 0 ) 
                    end 
                            else 
                                outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]", source, 255, 0, 0 ) 
                            end 
                                    else if cmd == "joinevent" then 
              
                                        giveWeapon ( tonumber(gunid), tonumber(ammo)) 
                                        outputChatBox("Ai intrat in event", source, 0, 255, 0 ) 
                                        setElementPosition ( source, eventmarker ) 
                                    end 
                                end 
                            end) 

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

  • MTA Team
Posted

For m91?nonsense=.png sake, we aren't here to fix your g76?nonsense=.png scripts at your beck and call. Part of scripting is to fix what mistakes you g76?nonsense=.png make, now learn how to debug or just.. sorry to say but .. or just get out!

Posted

try this:

local eventmarker 
addEventHandler("onPlayerCommand", root,function (source, cmd, gunid, ammo) 
    if cmd == "addevent" then 
        local x, y, z = getElementPosition(source)--getLocalPlayer is clientside and use getElementPosition to get the x,y,z 
        local accName = getAccountName( getPlayerAccount(source) ) 
        if gunid and ammo then 
            if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admins" ) ) then 
                eventmarker = createMarker (x, y, z, "cylinder", 5, 0, 0, 0, 0 ) 
                outputChatBox ("Adminul"..accName.."a pornit un event. [/joinevent]", source, 255, 0, 0 ) 
            else 
                outputChatBox ("[invalid Syntax]: /addevent [gunid] [ammo]", source, 255, 0, 0 ) 
            end --forgot this 
        else 
            outputChatBox ("Tre sa fi un admin boule", source, 255, 0, 0 ) 
        end --forgot this too 
    else if cmd = = "joinevent" then 
        giveWeapon (source, gunid, ammo) 
        outputChatBox("Ai intrat in event", source, 0, 255, 0 ) 
        setElementPosition ( source, getElementPosition(eventmarker))--more arguments are required!!! 
    end 
end) 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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