yMassai Posted March 26, 2012 Posted March 26, 2012 g_base_col = createColCuboid ( 97.3376, 1800.0384, -32.0937, 250, 280, 120 ) g_root = getRootElement () --rocketOne = createMarker ( -2931.5136, 454.4492, 17.3671, "corona", 9.5, 255, 0, 0, 150 ) --test marker --rocketTwo = createMarker ( -2931.5932, 487.1994, 17.3671, "corona", 9.5, 255, 0, 0, 150 ) --test marker function hit ( pla, dim ) if getElementType ( pla ) == "player" then local vehicle = getPlayerOccupiedVehicle ( pla ) if vehicle or not vehicle then local skin = getPlayerSkin ( pla ) if skin =={ [287] then ; [286] then ; } setElementData ( pla, "inRestrictedArea", "true" ) triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) outputChatBox ( "***Restricted Area***", pla, 255, 0, 0 ) outputChatBox ( "* "..getClientName(pla).." has entered Restricted Area!", g_root, 255, 0, 0 ) end end end end addEventHandler ( "onColShapeHit", g_base_col, hit ) This script shows when someone enters the military base. This script tells the player that he occupies the place is restricted. Can put for when a player enter the restricted area without skin 287 without taking a star?
Castillo Posted March 26, 2012 Posted March 26, 2012 That script will never work. if skin =={ [287] then ; [286] then ; } That's highly wrong. Should be: if ( skin == 287 or skin == 286 ) then For wanted level use: setPlayerWantedLevel.
yMassai Posted March 26, 2012 Author Posted March 26, 2012 g_base_col = createColCuboid ( 97.3376, 1800.0384, -32.0937, 250, 280, 120 ) g_root = getRootElement () --rocketOne = createMarker ( -2931.5136, 454.4492, 17.3671, "corona", 9.5, 255, 0, 0, 150 ) --test marker --rocketTwo = createMarker ( -2931.5932, 487.1994, 17.3671, "corona", 9.5, 255, 0, 0, 150 ) --test marker function hit ( pla, dim ) if getElementType ( pla ) == "player" then local vehicle = getPlayerOccupiedVehicle ( pla ) if vehicle or not vehicle then local skin = getPlayerSkin ( pla ) if ( skin == 287 or skin == 286 ) then setElementData ( pla, "inRestrictedArea", "true" ) triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) outputChatBox ( "***Restricted Area***", pla, 255, 0, 0 ) outputChatBox ( "* "..getClientName(pla).." has entered Restricted Area!", g_root, 255, 0, 0 ) end end end end function policeStationHit ( thePlayer ) setPlayerWantedLevel ( thePlayer , 1 ) addEventHandler ( "onColShapeHit", policeStation, policeStationHit ) addEventHandler ( "onColShapeHit", g_base_col, hit ) maybe this?
Castillo Posted March 26, 2012 Posted March 26, 2012 No, that won't work, you have to set the wanted level IF they are not using the desired skins.
yMassai Posted March 26, 2012 Author Posted March 26, 2012 how I could do this? I had never seen anything about setPlayerWantedLevel
Castillo Posted March 26, 2012 Posted March 26, 2012 Is not about the setPlayerWantedLevel function, this is Lua basics, you must use a 'else'. http://www.troubleshooters.com/codecorn ... and_Elseif
GanJaRuleZ Posted March 26, 2012 Posted March 26, 2012 g_base_col = createColCuboid ( 97.3376, 1800.0384, -32.0937, 250, 280, 120 ) g_root = getRootElement () --rocketOne = createMarker ( -2931.5136, 454.4492, 17.3671, "corona", 9.5, 255, 0, 0, 150 ) --test marker --rocketTwo = createMarker ( -2931.5932, 487.1994, 17.3671, "corona", 9.5, 255, 0, 0, 150 ) --test marker function hit ( pla, dim ) if getElementType ( pla ) == "player" then local vehicle = getPlayerOccupiedVehicle ( pla ) if vehicle or not vehicle then local skin = getPlayerSkin ( pla ) if ( skin == 287 or skin == 286 ) then setElementData ( pla, "inRestrictedArea", "true" ) triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) outputChatBox ( "***Restricted Area***", pla, 255, 0, 0 ) outputChatBox ( "* "..getClientName(pla).." has entered Restricted Area!", g_root, 255, 0, 0 ) setPlayerWantedLevel(pla,1) end end end end addEventHandler ( "onColShapeHit", g_base_col, hit )
Castillo Posted March 26, 2012 Posted March 26, 2012 @GanJaRuleZ: That's wrong, you're giving wanted level even when he's using the skins allowed. Also, I want him to do it, is really simple.
GanJaRuleZ Posted March 26, 2012 Posted March 26, 2012 Meh , i don't really saw what he wanted to do , i saw that there is a syntax error , and i fixed it Anyway , i will let him from now
Kenix Posted March 26, 2012 Posted March 26, 2012 Ninguem[ATZ], Learn LUA! viewtopic.php?f=148&t=40809
drk Posted March 26, 2012 Posted March 26, 2012 Then, script it by yourself. This is the basic of Lua. If you don't know how to do that, better start learning.
yMassai Posted March 26, 2012 Author Posted March 26, 2012 I know I have to do but the way I thought it was not work.
yMassai Posted March 27, 2012 Author Posted March 27, 2012 setPlayerWantedLevel(pla,1) as we know this command give a star to player, would put a time of 60 seconds to disappear this star?
yMassai Posted March 27, 2012 Author Posted March 27, 2012 (edited) someone could help me? I could using the SetTime? Edited March 27, 2012 by Guest
Castillo Posted March 27, 2012 Posted March 27, 2012 setTimer ( setPlayerWantedLevel, 60000, 1, pla, 0 )
yMassai Posted March 27, 2012 Author Posted March 27, 2012 g_base_col = createColCuboid ( 97.3376, 1800.0384, -32.0937, 250, 280, 120 ) g_root = getRootElement () --rocketOne = createMarker ( -2931.5136, 454.4492, 17.3671, "corona", 9.5, 255, 0, 0, 150 ) --test marker --rocketTwo = createMarker ( -2931.5932, 487.1994, 17.3671, "corona", 9.5, 255, 0, 0, 150 ) --test marker function hit ( pla, dim ) if getElementType ( pla ) == "player" then local vehicle = getPlayerOccupiedVehicle ( pla ) if vehicle or not vehicle then local skin = getPlayerSkin ( pla ) if ( skin == 287 or skin == 286 ) then setElementData ( pla, "inRestrictedArea", "true" ) triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) outputChatBox ( "***Restricted Area***", pla, 255, 0, 0 ) outputChatBox ( "* "..getClientName(pla).." has entered Restricted Area!", g_root, 255, 0, 0 ) setPlayerWantedLevel(pla,1) setTimer ( setPlayerWantedLevel, 60000, 1, pla, 1 ) end end end end addEventHandler ( "onColShapeHit", g_base_col, hit ) this?
Castillo Posted March 27, 2012 Posted March 27, 2012 Yes, but as far as I know, you want to reset it to 0.
yMassai Posted March 27, 2012 Author Posted March 27, 2012 SetTimer (setPlayerWantedLevel, 60000, 1, PLA, 0) ?
yMassai Posted March 27, 2012 Author Posted March 27, 2012 SetTimer (setPlayerWantedLevel, 60000, 0, PLA, 0) or SetTimer (setPlayerWantedLevel, 60000, 0, PLA, 1) ??
Castillo Posted March 27, 2012 Posted March 27, 2012 Don't you read? you only have to change 1 to 0 at: g_base_col = createColCuboid ( 97.3376, 1800.0384, -32.0937, 250, 280, 120 ) g_root = getRootElement () --rocketOne = createMarker ( -2931.5136, 454.4492, 17.3671, "corona", 9.5, 255, 0, 0, 150 ) --test marker --rocketTwo = createMarker ( -2931.5932, 487.1994, 17.3671, "corona", 9.5, 255, 0, 0, 150 ) --test marker function hit ( pla, dim ) if getElementType ( pla ) == "player" then local vehicle = getPlayerOccupiedVehicle ( pla ) if vehicle or not vehicle then local skin = getPlayerSkin ( pla ) if ( skin == 287 or skin == 286 ) then setElementData ( pla, "inRestrictedArea", "true" ) triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) outputChatBox ( "***Restricted Area***", pla, 255, 0, 0 ) outputChatBox ( "* "..getClientName(pla).." has entered Restricted Area!", g_root, 255, 0, 0 ) setPlayerWantedLevel(pla,1) setTimer ( setPlayerWantedLevel, 60000, 1, pla, 1 ) -- Here. end end end end addEventHandler ( "onColShapeHit", g_base_col, hit )
yMassai Posted March 27, 2012 Author Posted March 27, 2012 As you know I arrecem starting to make scripts, I hope not be upset , i ask all.
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