Jump to content

(S) kill


Hazard|

Recommended Posts

Posted

Hello, I'm wondering how to make this work exactly.

The point is that when a player includes (S) in his nickname, then on the next round (race) his vehicle gets blown and will have to spectate.

  
addEvent("onRaceStateChanging") 
addEventHandler("onRaceStateChanging", root, 
function getPlayerFromPartialName(name) 
    local name = name and name:gsub("#%x%x%x%x%x%x", "(S)"):lower() or nil 
    local theVehicle = getPedOccupiedVehicle ( player ) 
    if name then 
        for _, player in ipairs(getElementsByType("player")) do 
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", "(S)"):lower() 
            if name_:find(name, 1, true) then 
            for key, player in ipairs ( players ) do 
                if ( theVehicle ) then 
                blowVehicle(theVehicle,false) 
            end 
        end 
    end 
end 

I just wrote much shit and I get errors in the debug, I copied the

getPlayerFromPartialName 

from the wiki.

Could you make it work like I want it to work? if so, thanks alot.

If you want a decent paid scripter, don't contact me, I suck.

Posted
addEvent ( "onRaceStateChanging" ) 
addEventHandler ( "onRaceStateChanging", root, 
    function ( state ) 
        if ( state == "Running" ) then -- If the new state is "running" 
            for _, player in ipairs ( getElementsByType ( "player" ) ) do -- Loop all the ingame players 
                if getPlayerName ( player ):find ( "%(%S%)" ) then -- Check if their nickname contains (S) 
                    local theVehicle = getPedOccupiedVehicle ( player ) -- Get the player vehicle 
                    if ( theVehicle ) then -- If he/she is in a vehicle 
                        blowVehicle ( theVehicle, false ) -- Blow it up 
                    end 
                end 
            end 
        end 
    end 
) 

Try it.

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

It works thanks, but the problem is that now it blows all the players with a big S in their nick, I want it to blow the player only if he uses (S) :-s

Could you fix it? :-)

Thanks!

If you want a decent paid scripter, don't contact me, I suck.

Posted

Yeah, it's because parentheses are used for paterns, copy my code again and try it.

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

You're welcome.

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.

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