Jump to content

Can someone help me with this?


GamerDeMTA

Recommended Posts

Posted

What's wrong with these lines?

outputChatBox("You're in "..getTeamName( source ).. " team  "..getPlayerName( source ).. "",root,255,255,255,true) 

Also I want to do a table with outputchatboxs with TRUE AND ALSO 255, 255, 255 THOSE THINGS. I can without it, but with it it gives error.

setTimer ( function ( ) 
    outputChatBox ( tabl[math.random(#tabll)] ) 
end, 10000, 0 ) 

What I should do?

Posted

Well, in your first code, you are trying to get the team name from the player element, not from a team element, you must use getTeamName with getPlayerTeam.

And in your second code, how is "tabl" table constructed?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
setTimer ( 
    function ( ) 
        outputChatBox ( tabl [ math.random ( #tabll ) ], 255, 255, 255, true ) 
    end 
    ,10000, 0 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Try:
outputChatBox("You're in "..getTeamName( getPlayerTeam ( source ) ).. " team  "..getTeamName( getPlayerTeam ( source ) ),root,255,255,255,true) 

He put the name of the player in the end.

outputChatBox("You're in "..getTeamName( getPlayerTeam ( source ) ).. " team  "..getPlayerName( source ),root,255,255,255,true) 

State: Inactive

Posted
setTimer ( 
    function ( ) 
        outputChatBox ( tabl [ math.random ( #tabll ) ], 255, 255, 255, true ) 
    end 
    ,10000, 0 
) 

It doesn't work :(

Also when I type the command for my other commands like this:

addEventHandler ( "onPlayerChat", root, 
    function ( message ) 
        if ( message == "players" ) then 
            outputChatBox("we are "..getPlayerCount( source ).. " players",root,255,255,0,true) 
            cancelEvent ( ) 
        end 
    end 
) 

It shows the message before I say that :(((( I mean this happened, I say players[/ban] and...

Me: players

we are 1 players

It happened... That PLease Help

Posted

That code is client side, if you want to do it server side, you must fill the visibleTo argument.

setTimer ( 
    function ( ) 
        outputChatBox ( tabl [ math.random ( #tabl ) ], root, 255, 255, 255, true ) 
    end 
    ,10000, 0 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
setTimer ( 
    function ( ) 
        outputChatBox ( tabl [ math.random ( #tabll ) ], 255, 255, 255, true ) 
    end 
    ,10000, 0 
) 

It doesn't work

Also when I type the command for my other commands like this:

addEventHandler ( "onPlayerChat", root, 
    function ( message ) 
        if ( message == "players" ) then 
            outputChatBox("we are "..getPlayerCount( source ).. " players",root,255,255,0,true) 
            cancelEvent ( ) 
        end 
    end 
) 

It shows the message before I say that :(((( I mean this happened, I say players[/ban] and...

Me: players

we are 1 players

It happened... That PLease Help

getPlayerCount haven't arguments so delete "source".

State: Inactive

Posted

Ok but help me with this! When I type "ping" it shows the outputChatBox two times!

addEventHandler ( "onPlayerChat", root, 
    function ( message ) 
        if ( message == "ping" ) then 
            outputChatBox("your ping: "..getPlayerPing( source ).. " \"{SMILIES_PATH}/icon_biggrin.gif\" alt=\"\" title=\"Very Happy\" />",root,255,255,0,true) 
            cancelEvent ( ) 
        end 
    end 
) 

Why???

Posted

Make Sure Freeroam is Off and Try This ,

addEventHandler('onPlayerCommand', root, 
function ( cmd ) 
    if ( cmd ) == 'ping'  then 
    cancelEvent ( ) 
    outputChatBox('Your Ping'.. getPlayerName(source), root, 255, 255, 0 , true) 
 end 
end 
)     

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted
Make Sure Freeroam is Off and Try This ,
addEventHandler('onPlayerCommand', root, 
function ( cmd ) 
    if ( cmd ) == 'ping'  then 
    cancelEvent ( ) 
    outputChatBox('Your Ping'.. getPlayerName(source), root, 255, 255, 0 , true) 
 end 
end 
)     

Freeroam isn't running :S But I want to do it if player says "ping" not with a command. Please help

Posted
addEventHandler('onPlayerChat', root, -- When player sends the message in chatbox 
    function ( msg ) 
        if ( msg ) == 'ping'  then -- if message was "ping" then 
            cancelEvent ( ) -- don't show the message 
            outputChatBox(getPlayerName(source) .. "'s ping is: " .. getPlayerPing (source), root, 255, 255, 0 , true) -- Output player's name and ping 
        end 
    end 
)     

 

Posted

Try this:

addEventHandler('onPlayerChat', root, -- When player sends the message in chatbox 
    function ( msg, msgT ) 
        if msg  == 'ping' and msgT == 1 then -- if message was "ping" then 
            cancelEvent ( ) -- don't show the message 
            outputChatBox(getPlayerName(source) .. "'s ping is: " .. getPlayerPing (source), root, 255, 255, 0 , true) -- Output player's name and ping 
        end 
    end 
)     

State: Inactive

Posted
Try:
outputChatBox("You're in "..getTeamName( getPlayerTeam ( source ) ).. " team  "..getTeamName( getPlayerTeam ( source ) ),root,255,255,255,true) 

He put the name of the player in the end.

outputChatBox("You're in "..getTeamName( getPlayerTeam ( source ) ).. " team  "..getPlayerName( source ),root,255,255,255,true) 

oh, didn't see that. Sorry. Thanks for fixing it.

Posted
Try this:
addEventHandler('onPlayerChat', root, -- When player sends the message in chatbox 
    function ( msg, msgT ) 
        if msg  == 'ping' and msgT == 1 then -- if message was "ping" then 
            cancelEvent ( ) -- don't show the message 
            outputChatBox(getPlayerName(source) .. "'s ping is: " .. getPlayerPing (source), root, 255, 255, 0 , true) -- Output player's name and ping 
        end 
    end 
)     

Now it doesn't work ._. Pls someone help!!!

Posted

Is your problem still that it displays twice or what? because it works fine.

If it is still displaying twice, then you are obviously running another eventHandler with "onPlayerChat" .

Posted

Sorry change:

if msg  == 'ping' and msgT == 1 then  

to

if msg  == 'ping' and msgT == 0 then  

And check in the meta that the type script is server. Execute command debugscript 3 on game to see if it has error.

State: Inactive

Posted

Script works fine, there is another resource causing double messages. I remember I had the same problem, but forgot what was causing it exactly.

Try leaving only admin and this resource on and see what happens.

 

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...