Sidhkeer Posted June 3, 2015 Posted June 3, 2015 I want this to be used in my upcoming server and I also wants players to get paid whenever they perform stunt. Such as if they perform wheelie for 1 second they will get 10$ stoppie 1 second 20$ 2wheeler 1 second 50$ addEventHandler( "onClientPlayerStuntStart", getRootElement( ), function ( stuntType ) outputChatBox( "You started stunt: " .. stuntType ); end ); addEventHandler( "onClientPlayerStuntFinish", getRootElement( ), function ( stuntType, stuntTime, distance ) outputChatBox( "You finished stunt: " .. stuntType ..", Time: " .. tostring( stuntTime ).. ", Distance: " .. tostring( distance ) ); end ); Pls help me out
WhoAmI Posted June 3, 2015 Posted June 3, 2015 timer = false local money = { ["wheelie"] = 10, ["stoppie"] = 20, ["2wheeler"] = 50 } addEventHandler( "onClientPlayerStuntStart", getRootElement( ), function ( stuntType ) outputChatBox( "You started stunt: " .. stuntType ); timer = setTimer ( givePlayerMoney, 1000, 0, money[stuntType] ); end ); addEventHandler( "onClientPlayerStuntFinish", getRootElement( ), function ( stuntType, stuntTime, distance ) if isTimer ( timer ) then killTimer ( timer ) end end );
Walid Posted June 3, 2015 Posted June 3, 2015 Try this it should work local VehicleType = {['BMX'] = true, ['Bike'] = true } local sType = {["wheelie"] = 10,["stoppie"] = 20,["2wheeler"] = 50} addEventHandler( "onClientPlayerStuntFinish", getRootElement( ), function (stuntType, stuntTime, distance ) if ( source ~= localPlayer ) then return end local vehicle = getPedOccupiedVehicle ( source ) if ( not vehicle ) then return end if ( not VehicleType[getVehicleType(vehicle)] ) then return end local seconds = math.floor ( stuntTime / 1000 ) if ( seconds >= 2 and distance == 0 ) then money = seconds * sType[stuntType] outputChatBox("You finished stunt: "..tostring(stuntType)..", Time: "..tostring(seconds).." seconds! #00ff00+ $"..money,255,0,0,true) givePlayerMoney(tonumber(money)) elseif ( seconds > 0 and distance > 0 ) then money = ( seconds * sType[stuntType] ) + ( distance * 3 ) outputChatBox("You finished stunt: "..tostring(stuntType)..", Time: "..tostring(seconds).." seconds, Distance: "..tostring(distance).." meters! #00ff00+ $"..money,255,0,0,true) givePlayerMoney(tonumber(money)) end end ) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Sidhkeer Posted June 3, 2015 Author Posted June 3, 2015 thx a lot "WhoAmI, And @Walid if i want this to be work with distance covered?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now