yMassai Posted March 26, 2012 Share 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? Link to comment
Castillo Posted March 26, 2012 Share 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. Link to comment
yMassai Posted March 26, 2012 Author Share 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? Link to comment
Castillo Posted March 26, 2012 Share Posted March 26, 2012 No, that won't work, you have to set the wanted level IF they are not using the desired skins. Link to comment
yMassai Posted March 26, 2012 Author Share Posted March 26, 2012 how I could do this? I had never seen anything about setPlayerWantedLevel Link to comment
Castillo Posted March 26, 2012 Share 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 Link to comment
GanJaRuleZ Posted March 26, 2012 Share 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 ) Link to comment
Castillo Posted March 26, 2012 Share 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. Link to comment
GanJaRuleZ Posted March 26, 2012 Share 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 Link to comment
Kenix Posted March 26, 2012 Share Posted March 26, 2012 Ninguem[ATZ], Learn LUA! viewtopic.php?f=148&t=40809 Link to comment
drk Posted March 26, 2012 Share 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. Link to comment
yMassai Posted March 26, 2012 Author Share Posted March 26, 2012 I know I have to do but the way I thought it was not work. Link to comment
yMassai Posted March 27, 2012 Author Share 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? Link to comment
yMassai Posted March 27, 2012 Author Share Posted March 27, 2012 (edited) someone could help me? I could using the SetTime? Edited March 27, 2012 by Guest Link to comment
Castillo Posted March 27, 2012 Share Posted March 27, 2012 setTimer ( setPlayerWantedLevel, 60000, 1, pla, 0 ) Link to comment
yMassai Posted March 27, 2012 Author Share 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? Link to comment
Castillo Posted March 27, 2012 Share Posted March 27, 2012 Yes, but as far as I know, you want to reset it to 0. Link to comment
yMassai Posted March 27, 2012 Author Share Posted March 27, 2012 SetTimer (setPlayerWantedLevel, 60000, 1, PLA, 0) ? Link to comment
Castillo Posted March 27, 2012 Share Posted March 27, 2012 Just change the '1' to '0'. Link to comment
yMassai Posted March 27, 2012 Author Share Posted March 27, 2012 SetTimer (setPlayerWantedLevel, 60000, 0, PLA, 0) or SetTimer (setPlayerWantedLevel, 60000, 0, PLA, 1) ?? Link to comment
Castillo Posted March 27, 2012 Share 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 ) Link to comment
yMassai Posted March 27, 2012 Author Share Posted March 27, 2012 As you know I arrecem starting to make scripts, I hope not be upset , i ask all. Link to comment
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