Jump to content

Nothing when i starting my gamemode ??


Sky

Recommended Posts

Hi,

i have made a Stunt mode, but it don't work !

i have made it :

meta.xml :

<meta> 
    <info author="Sky" version="1.0" type="gamemode" name="Stunt"/> 
    <script src="stunt.lua" /> 
    <config src="help.xml" type="client" /> 
</meta> 

help.xml :

<help> 
blablabla.. 
<help/> 

stunt.lua :

  
function consoleCreateVehicle ( player, commandName, first, second, third ) 
    if ( player ) then 
        local id, x, y, z, r, d = 0, 0, 0, 0, 0, 5 
        local plate = false 
        r = getPlayerRotation ( player ) 
        x, y, z = getElementPosition ( player ) 
        x = x + ( ( math.cos ( math.rad ( r ) ) ) * d ) 
        y = y + ( ( math.sin ( math.rad ( r ) ) ) * d ) 
        if ( third ) then 
            id = getVehicleIDFromName ( first .. " " .. second ) 
            plate = third 
        elseif ( second ) then 
            if ( getVehicleIDFromName ( first .. " " .. second ) ) then 
                id = getVehicleIDFromName ( first .. " " .. second ) 
            else 
                id = getVehicleIDFromName ( first ) 
                if ( not id ) then 
                    id = tonumber ( first ) 
                end 
                plate = second 
            end          
        else 
            id = getVehicleIDFromName ( first ) 
            if ( not id ) then 
                id = tonumber ( first ) 
            end 
        end 
        local veh = false 
        if ( plate == false ) then 
            veh = createVehicle ( id, x, y, z, 0, 0, r ) 
            --toggleVehicleRespawn ( veh, false ) 
        else 
            veh = createVehicle ( id, x, y, z, 0, 0, r, plate ) 
            --toggleVehicleRespawn ( veh, false ) 
        end 
        if ( veh == false ) then  outputConsole ( "Failed to create vehicle.", player )  end 
    end 
end 
  
function consoleAttachTrailer ( player, commandName, trailerid, vehicleid ) 
    if ( player ) then 
        if ( vehicleid ) then 
            local sx, sy, id, x, y, z, r, d = 0, 0, 0, 0, 0, 0, 0, 5 
            r = getPlayerRotation ( player ) 
            sx, sy, z = getElementPosition ( player ) 
            x = sx + ( math.cos ( math.rad ( r ) ) * d ) 
            y = sy + ( math.sin ( math.rad ( r ) ) * d ) 
            local veh = createVehicle ( tonumber ( vehicleid ), x, y, z, 0, 0, r ) 
            x = sx + ( ( math.cos ( math.rad ( r ) ) ) * ( d + 7.5 ) ) 
            y = sy + ( ( math.sin ( math.rad ( r ) ) ) * ( d + 7.5 ) ) 
            local trailer = createVehicle ( tonumber ( trailerid ), x, y, z, 0, 0, r ) 
            if ( veh and trailer ) then 
                --toggleVehicleRespawn ( veh, false ) 
                --toggleVehicleRespawn ( trailer, false ) 
                if ( attachTrailerToVehicle ( veh, trailer ) == false ) then  outputConsole ( "Failed to attach vehicle.", player )  end 
            else 
                outputConsole ( "Failed to create vehicle and/or trailer.", player ) 
            end 
        else             
            if ( isPlayerInVehicle ( player ) ) then 
                local veh = getPlayerOccupiedVehicle ( player ) 
                local sx, sy, id, x, y, z, rx, ry, rz, d = 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.5 
                rx, ry, rz = getVehicleRotation ( veh ) 
                sx, sy, z = getElementPosition ( veh ) 
                x = sx + ( ( math.cos ( math.rad ( rz + 270 ) ) ) * d ) 
                y = sy + ( ( math.sin ( math.rad ( rz + 270 ) ) ) * d ) 
                local trailer = createVehicle ( tonumber ( trailerid ), x, y, z, rx, ry, rz ) 
                if ( trailer ) then 
                    --toggleVehicleRespawn ( trailer, false ) 
                    if ( attachTrailerToVehicle ( veh, trailer ) == false ) then  outputConsole ( "Failed to attach vehicle.", player )  end 
                else 
                    outputConsole ( "Failed to create trailer.", player ) 
                end 
            else 
                outputConsole ( "You must be in a vehicle if VEHICLEID argument is excluded.", player ) 
            end 
        end 
    end 
end 
  
  
local root = getRootElement () 
local thisResourceRoot = getResourceRootElement(getThisResource()) 
  
function thisResourceStart () 
    outputChatBox ( "Script stunt. Type /stunt for more info. Tapez /stunt pour plus d'info." ) 
    local players = getElementsByType ( "player" ) 
    for k,v in ipairs(players) do 
        bindKey ( v, "=", "down", "Lights on/off", toggleVehicleLights  ) 
        bindKey ( v, "l", "down", "Lock/unlock door", toggleVehicleLock ) 
    end 
end 
  
function playerWasted ( ammo, killer, weapon ) 
    local x, y, z = getElementPosition ( source ) 
    setTimer ( destroyElement, 3000, 1, createBlip ( x, y, z, 0, 2, 255, 255, 255, 170 ) ) 
end       
  
function playerJoin () 
    outputChatBox ( "Script stunt. Type /stunt for more info. Tapez /stunt pour plus d'info.", source ) 
    bindKey ( source, "=", "down", toggleVehicleLights, "Lights on/off" ) 
    bindKey ( source, "l", "down", toggleVehicleLock, "Lock/unlock door" ) 
end 
  
  
function stunt ( command ) 
  outputChatBox ( "/createvehicle - Boutton 'i' (Teleportation) - 'l' (lock his car/son vehicule", playerSource) 
end 
addCommandHandler ( "stunt", stunt ) 
  
  
addEventHandler ( "onResourceStart", thisResourceRoot, thisResourceStart ) 
addEventHandler ( "onPlayerWasted", root, playerWasted ) 
addEventHandler ( "onPlayerJoin", root, playerJoin ) 
addCommandHandler ( "createvehicle", consoleCreateVehicle ) 

and the map in a new .zip :

meta.xml:

<meta> 
    <info type="map" gamemodes="Stunt" name="perfectstunt" /> 
    <race src="perfectstunt.map" /> 
</meta> 

stunt.map : i have convert it's ok .

and when i start the gamemode ( /votemap Stunt stunt ) i have nothing .

what is the probleme ?

thank you .

Link to comment

50p: no, it don't work :S

gothem: i have search here, but i don't have find : http://development.mtasa.com/index.php? ... ap_manager

what do i must add ?

PS: the map i use is it :

<map> 
  
<spawnpoint posX="-1270.573486" posY="-343.592255" posZ="13.808815" rot="360"/> 
<spawnpoint posX="-1409.330933" posY="-198.068878" posZ="25.097878" rot="360"/> 
<spawnpoint posX="-1569.554810" posY="-211.525467" posZ="13.804344" rot="360"/> 
<spawnpoint posX="-1356.282593" posY="48.886826" posZ="14.145460" rot="360"/> 
<spawnpoint posX="-1795.750000" posY="539.724854" posZ="234.547791" rot="360"/> 
<spawnpoint posX="-1785.942261" posY="554.555481" posZ="234.547791" rot="360"/> 
<spawnpoint posX="-1821.666016" posY="558.052368" posZ="234.550995" rot="360"/> 
<spawnpoint posX="-986.004089" posY="-1056.597290" posZ="412.321106" rot="360"/> 
<spawnpoint posX="-970.293091" posY="-1056.714722" posZ="412.321106" rot="360"/> 
<spawnpoint posX="-1423.047852" posY="-555.285034" posZ="13.808815" rot="360"/> 
  
<object id="object (2)" posX="-1366.733154" posY="-37.948898" posZ="14.195759" rotX="0" rotY="0" rotZ="44.999991" model="1634" /> 
<object id="object (3)" posX="-1369.186279" posY="-40.335659" posZ="14.220758" rotX="0" rotY="0" rotZ="44.999991" model="1634" /> 
<object id="object (4)" posX="-1372.032471" posY="-43.145008" posZ="14.220758" rotX="0" rotY="0" rotZ="44.999991" model="1634" /> 
<object id="object (5)" posX="-1374.471924" posY="-45.811562" posZ="14.120760" rotX="0" rotY="0" rotZ="44.999991" model="1634" /> 
<object id="object (6)" posX="-1372.892822" posY="-39.222706" posZ="17.712214" rotX="24.923664" rotY="0" rotZ="44.999991" model="1634" /> 
<object id="object (7)" posX="-1397.356812" posY="-45.632824" posZ="14.195759" rotX="0" rotY="0" rotZ="-44.999991" model="1634" /> 
<object id="object (8)" posX="-1400.232910" posY="-42.706249" posZ="14.220758" rotX="0" rotY="0" rotZ="-44.999991" model="1634" /> 
<object id="object (9)" posX="-1403.156494" posY="-39.799290" posZ="14.220758" rotX="0" rotY="0" rotZ="-44.999991" model="1634" /> 
<object id="object (10)" posX="-1405.977295" posY="-36.960129" posZ="14.245758" rotX="0" rotY="0" rotZ="-44.999991" model="1634" /> 
<object id="object (11)" posX="-1375.702271" posY="-42.065250" posZ="17.712688" rotX="24.923664" rotY="0" rotZ="44.999991" model="1634" /> 
<object id="object (12)" posX="-1370.057495" posY="-36.600094" posZ="17.575945" rotX="24.923664" rotY="0" rotZ="44.999991" model="1634" /> 
<object id="object (16)" posX="-1396.351685" posY="-42.454880" posZ="17.420870" rotX="24.923664" rotY="0" rotZ="-44.999991" model="1634" /> 
<object id="object (17)" posX="-1399.182251" posY="-39.500015" posZ="17.526381" rotX="24.923664" rotY="0" rotZ="-44.999991" model="1634" /> 
<object id="object (18)" posX="-1401.876831" posY="-36.627686" posZ="17.681599" rotX="24.923664" rotY="0" rotZ="-44.999991" model="1634" /> 
<object id="object (19)" posX="-1366.756836" posY="-14.264473" posZ="14.070761" rotX="0" rotY="0" rotZ="134.999972" model="1634" /> 
<object id="object (20)" posX="-1369.666870" posY="-11.358990" posZ="14.070761" rotX="0" rotY="0" rotZ="134.999972" model="1634" /> 
<object id="object (21)" posX="-1372.631348" posY="-8.402603" posZ="14.120760" rotX="0" rotY="0" rotZ="134.999972" model="1634" /> 
<object id="object (22)" posX="-1375.373047" posY="-5.633392" posZ="14.120760" rotX="0" rotY="0" rotZ="134.999972" model="1634" /> 
<object id="object (23)" posX="-1370.058472" posY="-15.110668" posZ="17.331358" rotX="24.923664" rotY="0" rotZ="134.999972" model="1634" /> 
<object id="object (24)" posX="-1372.919067" posY="-12.228965" posZ="17.370737" rotX="24.923664" rotY="0" rotZ="134.999972" model="1634" /> 
<object id="object (25)" posX="-1375.715942" posY="-9.445442" posZ="17.422935" rotX="24.923664" rotY="0" rotZ="134.999972" model="1634" /> 
<object id="object (27)" posX="-1389.010376" posY="-46.163464" posZ="13.988658" rotX="0" rotY="0" rotZ="0" model="973" /> 
<object id="object (28)" posX="-1383.225464" posY="-46.249451" posZ="13.988658" rotX="0" rotY="0" rotZ="0" model="973" /> 
<object id="object (29)" posX="-1365.360107" posY="-22.862785" posZ="13.988658" rotX="0" rotY="0" rotZ="-78.750012" model="973" /> 
<object id="object (30)" posX="-1383.509155" posY="-5.671257" posZ="13.988658" rotX="0" rotY="0" rotZ="-168.749994" model="973" /> 
<object id="object (31)" posX="-1390.973022" posY="-9.620872" posZ="13.988658" rotX="0" rotY="0" rotZ="-134.999972" model="973" /> 
<object id="object (32)" posX="-1397.181519" posY="-15.955399" posZ="13.988658" rotX="0" rotY="0" rotZ="-134.999972" model="973" /> 
<object id="object (34)" posX="-1406.378418" posY="-28.807343" posZ="13.988658" rotX="0" rotY="0" rotZ="-101.24995" model="973" /> 
<object id="object (35)" posX="-1402.258057" posY="-20.955673" posZ="13.988658" rotX="0" rotY="0" rotZ="-134.999972" model="973" /> 
<object id="object (36)" posX="-1366.436157" posY="-30.952076" posZ="13.988658" rotX="0" rotY="0" rotZ="-112.499977" model="973" /> 
<object id="object (49)" posX="-1382.469604" posY="-21.133335" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (50)" posX="-1379.052612" posY="-24.064671" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (51)" posX="-1380.073364" posY="-27.997864" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (52)" posX="-1381.365723" posY="-30.882439" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (53)" posX="-1382.253906" posY="-33.053337" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (54)" posX="-1385.054443" posY="-36.215515" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (55)" posX="-1387.700073" posY="-39.184948" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (56)" posX="-1390.337646" posY="-38.527328" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (57)" posX="-1395.803833" posY="-33.711117" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (58)" posX="-1399.133179" posY="-26.794212" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (59)" posX="-1397.180786" posY="-23.668091" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (60)" posX="-1394.314087" posY="-18.480225" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (61)" posX="-1392.367676" posY="-14.036957" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (62)" posX="-1390.595093" posY="-13.854797" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (63)" posX="-1384.760864" posY="-10.186630" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (64)" posX="-1384.448364" posY="-9.780930" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (65)" posX="-1381.804565" posY="-13.570908" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (66)" posX="-1382.181885" posY="-16.518097" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (67)" posX="-1385.921997" posY="-15.815430" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (68)" posX="-1388.591064" posY="-14.185356" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (69)" posX="-1389.868286" posY="-22.911125" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (70)" posX="-1390.005127" posY="-23.387909" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (71)" posX="-1385.417603" posY="-25.007835" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (72)" posX="-1383.925903" posY="-22.571045" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (73)" posX="-1371.611694" posY="-26.928017" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (74)" posX="-1369.091064" posY="-25.340843" posZ="13.554196" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (75)" posX="-1367.790771" posY="-24.110661" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (76)" posX="-1368.017578" posY="-21.846722" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (77)" posX="-1372.269531" posY="-22.250744" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (78)" posX="-1374.563477" posY="-26.137581" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (79)" posX="-1375.951782" posY="-28.250504" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (80)" posX="-1377.788696" posY="-30.339039" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (81)" posX="-1380.976196" posY="-34.320808" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (82)" posX="-1389.374268" posY="-29.888493" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (83)" posX="-1386.583984" posY="-30.609192" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (84)" posX="-1386.529297" posY="-32.698196" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (85)" posX="-1392.056030" posY="-31.307499" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (86)" posX="-1391.740112" posY="-29.991465" posZ="14.542231" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (87)" posX="-1384.170288" posY="-24.104881" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (88)" posX="-1384.080933" posY="-21.740372" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (89)" posX="-1388.903198" posY="-18.015442" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (90)" posX="-1378.083740" posY="-14.695091" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (91)" posX="-1374.058960" posY="-15.489014" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (92)" posX="-1381.079102" posY="-35.862541" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (93)" posX="-1377.328003" posY="-30.925949" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (94)" posX="-1373.286499" posY="-30.222197" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (95)" posX="-1373.171997" posY="-30.318392" posZ="13.554193" rotX="0" rotY="0" rotZ="0" model="1225" /> 
<object id="object (96)" posX="-1381.434082" posY="-163.393829" posZ="13.224054" rotX="0" rotY="0" rotZ="-22.499938" model="3279" /> 
<object id="object (97)" posX="-1383.807861" posY="-189.391663" posZ="13.171885" rotX="0" rotY="0" rotZ="0" model="1212" /> 
<object id="object (98)" posX="-1216.244873" posY="149.345154" posZ="14.723449" rotX="0" rotY="0" rotZ="0" model="3461" /> 
<object id="object (99)" posX="-1195.863037" posY="170.261612" posZ="14.723449" rotX="0" rotY="0" rotZ="0" model="3461" /> 
<object id="object (100)" posX="-930.564697" posY="-102.261780" posZ="57.749756" rotX="0" rotY="0" rotZ="0" model="3515" /> 
<object id="object (101)" posX="-942.762207" posY="-116.161118" posZ="56.928543" rotX="0" rotY="0" rotZ="0" model="3515" /> 
<object id="object (102)" posX="-927.146729" posY="-94.656372" posZ="70.386414" rotX="0" rotY="0" rotZ="-112.499977" model="7073" /> 
<object id="object (103)" posX="-742.169678" posY="239.527863" posZ="9.706492" rotX="0" rotY="0" rotZ="146.249998" model="7392" /> 
<object id="object (106)" posX="-1189.056763" posY="257.122131" posZ="8.257763" rotX="0" rotY="0" rotZ="22.499995" model="16776" /> 
<object id="object (110)" posX="-1325.800903" posY="-367.210388" posZ="19.022987" rotX="0" rotY="0" rotZ="191.249989" model="5822" /> 
<object id="object (111)" posX="-1249.623413" posY="-382.435669" posZ="19.051064" rotX="0" rotY="0" rotZ="-11.250026" model="1683" /> 
<object id="object (112)" posX="-1241.328369" posY="-399.870239" posZ="14.170759" rotX="0" rotY="0" rotZ="-22.499995" model="1634" /> 
<object id="object (113)" posX="-1266.150024" posY="-405.503204" posZ="14.020761" rotX="0" rotY="0" rotZ="-33.750022" model="1634" /> 
<object id="object (256)" posX="-1485.623413" posY="-661.227600" posZ="19.609631" rotX="27.501974" rotY="0" rotZ="-89.999981" model="1634" /> 
<object id="object (257)" posX="-1485.622925" posY="-664.751099" posZ="19.641607" rotX="27.501974" rotY="0" rotZ="-89.999981" model="1634" /> 
<object id="object (259)" posX="-1322.082642" posY="-481.687927" posZ="13.891296" rotX="0" rotY="0" rotZ="33.750022" model="13645" /> 
<object id="object (260)" posX="-1323.199585" posY="-479.885956" posZ="15.209103" rotX="21.485917" rotY="11.172677" rotZ="32.031148" model="13645" /> 
<object id="object (261)" posX="-1324.105103" posY="-478.057556" posZ="17.191351" rotX="26.642537" rotY="16.329297" rotZ="24.296218" model="13645" /> 
<object id="object (262)" posX="-1547.084717" posY="-114.975639" posZ="14.169203" rotX="0" rotY="0" rotZ="-224.999953" model="1634" /> 
<object id="object (263)" posX="-1637.352661" posY="-251.656967" posZ="14.020761" rotX="0" rotY="0" rotZ="-405.00003" model="1634" /> 
<object id="object (264)" posX="-1260.458862" posY="32.056633" posZ="13.629615" rotX="0" rotY="0" rotZ="0" model="3786" /> 
<object id="object (265)" posX="-1259.448853" posY="35.642967" posZ="13.660314" rotX="0" rotY="0" rotZ="11.250026" model="3788" /> 
<object id="object (266)" posX="-1259.424561" posY="35.631157" posZ="13.772115" rotX="0" rotY="0" rotZ="11.250026" model="3790" /> 
<object id="object (267)" posX="-1259.275269" posY="29.441322" posZ="13.667796" rotX="0" rotY="0" rotZ="22.499995" model="3788" /> 
<object id="object (268)" posX="-1254.696045" posY="32.439323" posZ="13.747840" rotX="0" rotY="0" rotZ="-67.499986" model="3794" /> 
<object id="object (269)" posX="-1262.357056" posY="37.871803" posZ="13.480417" rotX="0" rotY="0" rotZ="78.750012" model="3795" /> 
<object id="object (270)" posX="-1263.616089" posY="33.759415" posZ="14.864293" rotX="0" rotY="0" rotZ="0" model="3797" /> 
<object id="object (271)" posX="-1257.607422" posY="24.360619" posZ="13.777658" rotX="0" rotY="0" rotZ="-44.999991" model="2064" /> 
<object id="object (272)" posX="-1267.510620" posY="33.697845" posZ="13.777658" rotX="0" rotY="0" rotZ="-44.999991" model="2064" /> 
<object id="object (273)" posX="-1259.506226" posY="25.261856" posZ="13.440367" rotX="0" rotY="0" rotZ="-44.999991" model="2061" /> 
<object id="object (274)" posX="-1258.904053" posY="27.106590" posZ="13.440367" rotX="0" rotY="0" rotZ="-44.999991" model="2061" /> 
<object id="object (275)" posX="-1258.905518" posY="27.219383" posZ="13.440367" rotX="0" rotY="0" rotZ="-44.999991" model="2061" /> 
<object id="object (276)" posX="-1259.599731" posY="27.386734" posZ="13.440367" rotX="0" rotY="0" rotZ="-44.999991" model="2061" /> 
<object id="object (277)" posX="-1265.549072" posY="33.344734" posZ="13.440367" rotX="0" rotY="0" rotZ="-44.999991" model="2061" /> 
<object id="object (278)" posX="-1265.703125" posY="33.193375" posZ="13.440367" rotX="0" rotY="0" rotZ="-44.999991" model="2061" /> 
<object id="object (279)" posX="-1266.220337" posY="33.310287" posZ="13.440367" rotX="0" rotY="0" rotZ="-44.999991" model="2061" /> 
<object id="object (280)" posX="-1266.110352" posY="33.108757" posZ="13.440367" rotX="0" rotY="0" rotZ="-44.999991" model="2061" /> 
<object id="object (281)" posX="-1265.770508" posY="37.618057" posZ="13.310635" rotX="0" rotY="0" rotZ="0" model="2057" /> 
<object id="object (282)" posX="-1252.837280" posY="25.281876" posZ="13.541780" rotX="0" rotY="0" rotZ="0" model="1550" /> 
<object id="object (283)" posX="-1474.766235" posY="-94.903862" posZ="12.832075" rotX="0" rotY="0" rotZ="-44.999991" model="5400" /> 
<object id="object (284)" posX="-1077.384644" posY="-264.313416" posZ="16.757019" rotX="0" rotY="0" rotZ="11.250026" model="5390" /> 
<object id="object (285)" posX="-1091.898682" posY="-235.034515" posZ="18.229063" rotX="0" rotY="0" rotZ="11.250026" model="5400" /> 
<object id="object (286)" posX="-1108.553589" posY="-266.144989" posZ="14.153214" rotX="0" rotY="0" rotZ="-202.500015" model="3819" /> 
<object id="object (288)" posX="-1563.759766" posY="-244.169098" posZ="22.939600" rotX="0" rotY="0" rotZ="-123.749946" model="13592" /> 
<object id="object (289)" posX="-1635.775879" posY="-200.629242" posZ="23.019054" rotX="0" rotY="0" rotZ="-123.749946" model="13592" /> 
<object id="object (290)" posX="-1342.267944" posY="83.138733" posZ="22.873449" rotX="0" rotY="0" rotZ="-236.249979" model="13592" /> 
<object id="object (310)" posX="-1739.862549" posY="-511.990753" posZ="90.052704" rotX="0" rotY="0" rotZ="-44.999991" model="13603" /> 
<object id="object (331)" posX="-1942.511597" posY="-434.863159" posZ="105.341866" rotX="0" rotY="0" rotZ="-44.999991" model="12880" /> 
<object id="object (332)" posX="-1995.008179" posY="-498.549194" posZ="114.286079" rotX="7.73493" rotY="0" rotZ="-224.999953" model="1634" /> 
<object id="object (333)" posX="-2001.623779" posY="-482.358826" posZ="112.150002" rotX="9.453804" rotY="0" rotZ="-224.999953" model="1634" /> 
<object id="object (335)" posX="-1182.334839" posY="322.384766" posZ="14.173553" rotX="0" rotY="0" rotZ="-44.999991" model="1655" /> 
<object id="object (336)" posX="-1177.225708" posY="327.411438" posZ="17.950125" rotX="9.453804" rotY="0" rotZ="-46.718864" model="1655" /> 
<object id="object (337)" posX="-1174.568604" posY="330.023621" posZ="21.121489" rotX="20.626481" rotY="0" rotZ="-44.999991" model="1655" /> 
<object id="object (338)" posX="-1171.941040" posY="332.053558" posZ="24.655489" rotX="29.220848" rotY="0" rotZ="-44.140554" model="1655" /> 
<object id="object (339)" posX="-1169.805542" posY="333.956696" posZ="28.886925" rotX="38.674651" rotY="0" rotZ="-43.281117" model="1655" /> 
<object id="object (340)" posX="-1167.757446" posY="335.252838" posZ="35.584831" rotX="56.722764" rotY="0" rotZ="-44.999991" model="1655" /> 
<object id="object (341)" posX="-1167.328613" posY="334.692139" posZ="39.568584" rotX="74.770935" rotY="0" rotZ="-47.578301" model="1655" /> 
<object id="object (342)" posX="-1167.922485" posY="333.092133" posZ="45.267155" rotX="88.521922" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (343)" posX="-1169.319824" posY="330.759949" posZ="50.040501" rotX="100.554036" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (344)" posX="-1171.935181" posY="327.222382" posZ="54.613201" rotX="121.180516" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (346)" posX="-1176.840942" posY="321.700623" posZ="57.766468" rotX="145.244916" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (347)" posX="-1182.178345" posY="315.562012" posZ="58.086685" rotX="164.152637" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (348)" posX="-1186.419922" posY="310.642120" posZ="55.793056" rotX="187.3576" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (349)" posX="-1188.898804" posY="307.341370" posZ="51.890671" rotX="210.562563" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (350)" posX="-1189.648804" posY="305.592041" posZ="48.893612" rotX="225.173101" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (351)" posX="-1189.720459" posY="304.321167" posZ="44.831932" rotX="244.080594" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (352)" posX="-1188.877808" posY="304.194824" posZ="39.012070" rotX="261.269156" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (353)" posX="-1187.193726" posY="304.350677" posZ="35.527065" rotX="281.895464" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (354)" posX="-1184.137939" posY="305.837585" posZ="31.849648" rotX="302.521773" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (355)" posX="-1179.640503" posY="308.292694" posZ="28.791042" rotX="310.256589" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (356)" posX="-1174.664795" posY="312.174744" posZ="26.154186" rotX="319.710335" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (357)" posX="-1171.508911" posY="314.694763" posZ="25.064590" rotX="324.866898" rotY="0" rotZ="-48.437737" model="1655" /> 
<object id="object (358)" posX="-1167.150391" posY="318.856720" posZ="24.100111" rotX="-29.220848" rotY="0" rotZ="-44.999991" model="1655" /> 
<object id="object (359)" posX="-1165.709839" posY="323.718201" posZ="22.859234" rotX="0" rotY="0" rotZ="-44.999991" model="3852" /> 
<object id="object (360)" posX="-1163.166382" posY="321.222351" posZ="22.857048" rotX="0" rotY="0" rotZ="-44.999991" model="3852" /> 
<object id="object (361)" posX="-1161.999512" posY="320.076508" posZ="22.840973" rotX="0" rotY="0" rotZ="-44.999991" model="3852" /> 
<object id="object (362)" posX="-1147.676636" posY="338.378754" posZ="13.375021" rotX="26.642537" rotY="0" rotZ="-224.999953" model="5797" /> 
<object id="object (363)" posX="-1065.604858" posY="396.594971" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (364)" posX="-1067.890137" posY="399.068115" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (365)" posX="-1069.941040" posY="401.089417" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (366)" posX="-1072.172607" posY="403.382202" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (367)" posX="-1074.739136" posY="406.167389" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (368)" posX="-1077.302124" posY="409.000580" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (369)" posX="-1079.910156" posY="411.572571" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (370)" posX="-1082.761597" posY="414.180664" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (371)" posX="-1085.297729" posY="417.221497" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (372)" posX="-1087.640381" posY="419.580658" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (373)" posX="-1090.320801" posY="421.947144" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (374)" posX="-1092.750854" posY="424.562500" posZ="14.635075" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (375)" posX="-1095.504639" posY="426.338013" posZ="14.939426" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (376)" posX="-1083.076416" posY="429.257660" posZ="14.819321" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (377)" posX="-1087.636353" posY="433.858032" posZ="14.823021" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (378)" posX="-1079.709595" posY="438.594757" posZ="15.033607" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (379)" posX="-1075.929565" posY="434.184814" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (380)" posX="-1075.949707" posY="425.168579" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (381)" posX="-1069.947632" posY="417.214752" posZ="14.918562" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (382)" posX="-1062.548706" posY="416.235382" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (383)" posX="-1067.354004" posY="429.596863" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (384)" posX="-1068.304688" posY="434.998383" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (385)" posX="-1071.639648" posY="445.061829" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (386)" posX="-1066.934814" posY="451.262817" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (387)" posX="-1063.887451" posY="445.128448" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (388)" posX="-1058.470093" posY="437.115875" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (389)" posX="-1054.872070" posY="426.926331" posZ="15.033611" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (390)" posX="-1054.416748" posY="418.847748" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (391)" posX="-1051.094238" posY="407.470184" posZ="14.881882" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (392)" posX="-1057.633057" posY="404.377319" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (393)" posX="-1062.845703" posY="408.751434" posZ="14.794149" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (394)" posX="-1074.563843" posY="416.085388" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (395)" posX="-1080.966187" posY="423.247345" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (396)" posX="-1086.721191" posY="425.939545" posZ="14.642414" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (397)" posX="-1059.602417" posY="431.101898" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (398)" posX="-1044.127808" posY="425.718018" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (399)" posX="-1032.892944" posY="431.353668" posZ="15.033611" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (400)" posX="-1045.217529" posY="443.021912" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (401)" posX="-1050.729492" posY="449.035461" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (402)" posX="-1059.568481" posY="461.807831" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (403)" posX="-1064.673706" posY="460.276093" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (404)" posX="-1071.050781" posY="455.460022" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (405)" posX="-1078.297852" posY="448.912811" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (406)" posX="-1082.607422" posY="444.792084" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (407)" posX="-1085.506470" posY="442.389099" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (408)" posX="-1075.899902" posY="443.373474" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (409)" posX="-1066.951538" posY="441.039520" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (410)" posX="-1056.222778" posY="443.145691" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (411)" posX="-1047.278931" posY="434.956055" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (412)" posX="-1048.600464" posY="429.662537" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (413)" posX="-1043.750732" posY="418.518951" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (414)" posX="-1035.734375" posY="441.399872" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (415)" posX="-1020.816223" posY="443.348175" posZ="15.033609" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
<object id="object (416)" posX="-1027.291992" posY="453.560974" posZ="15.040852" rotX="0" rotY="0" rotZ="-44.999991" model="3374" /> 
</map> 
  

it's correct no ? ( i have delete some line because i have reach the nomber max of letter ^^ )

Thx.

Link to comment

i have add it in stunt.lua

  
[b]fadeCamera( thePlayer, true)[/b] 
  
function consoleCreateVehicle ( player, commandName, first, second, third ) 
    if ( player ) then 
        local id, x, y, z, r, d = 0, 0, 0, 0, 0, 5 
        local plate = false 
        r = getPlayerRotation ( player ) 
        x, y, z = getElementPosition ( player ) 
        x = x + ( ( math.cos ( math.rad ( r ) ) ) * d ) 
        y = y + ( ( math.sin ( math.rad ( r ) ) ) * d ) 
        if ( third ) then 
            id = getVehicleIDFromName ( first .. " " .. second ) 
            plate = third 
        elseif ( second ) then 
            if ( getVehicleIDFromName ( first .. " " .. second ) ) then 
                id = getVehicleIDFromName ( first .. " " .. second ) 
            else 
                id = getVehicleIDFromName ( first ) 
                if ( not id ) then 
                    id = tonumber ( first ) 
                end 
                plate = second 
            end         
        else 
            id = getVehicleIDFromName ( first ) 
            if ( not id ) then 
                id = tonumber ( first ) 
            end 
        end 
        local veh = false 
        if ( plate == false ) then 
            veh = createVehicle ( id, x, y, z, 0, 0, r ) 
            --toggleVehicleRespawn ( veh, false ) 
        else 
            veh = createVehicle ( id, x, y, z, 0, 0, r, plate ) 
            --toggleVehicleRespawn ( veh, false ) 
        end 
        if ( veh == false ) then  outputConsole ( "Failed to create vehicle.", player )  end 
    end 
end 
  
function consoleAttachTrailer ( player, commandName, trailerid, vehicleid ) 
    if ( player ) then 
        if ( vehicleid ) then 
            local sx, sy, id, x, y, z, r, d = 0, 0, 0, 0, 0, 0, 0, 5 
            r = getPlayerRotation ( player ) 
            sx, sy, z = getElementPosition ( player ) 
            x = sx + ( math.cos ( math.rad ( r ) ) * d ) 
            y = sy + ( math.sin ( math.rad ( r ) ) * d ) 
            local veh = createVehicle ( tonumber ( vehicleid ), x, y, z, 0, 0, r ) 
            x = sx + ( ( math.cos ( math.rad ( r ) ) ) * ( d + 7.5 ) ) 
            y = sy + ( ( math.sin ( math.rad ( r ) ) ) * ( d + 7.5 ) ) 
            local trailer = createVehicle ( tonumber ( trailerid ), x, y, z, 0, 0, r ) 
            if ( veh and trailer ) then 
                --toggleVehicleRespawn ( veh, false ) 
                --toggleVehicleRespawn ( trailer, false ) 
                if ( attachTrailerToVehicle ( veh, trailer ) == false ) then  outputConsole ( "Failed to attach vehicle.", player )  end 
            else 
                outputConsole ( "Failed to create vehicle and/or trailer.", player ) 
            end 
        else            
            if ( isPlayerInVehicle ( player ) ) then 
                local veh = getPlayerOccupiedVehicle ( player ) 
                local sx, sy, id, x, y, z, rx, ry, rz, d = 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.5 
                rx, ry, rz = getVehicleRotation ( veh ) 
                sx, sy, z = getElementPosition ( veh ) 
                x = sx + ( ( math.cos ( math.rad ( rz + 270 ) ) ) * d ) 
                y = sy + ( ( math.sin ( math.rad ( rz + 270 ) ) ) * d ) 
                local trailer = createVehicle ( tonumber ( trailerid ), x, y, z, rx, ry, rz ) 
                if ( trailer ) then 
                    --toggleVehicleRespawn ( trailer, false ) 
                    if ( attachTrailerToVehicle ( veh, trailer ) == false ) then  outputConsole ( "Failed to attach vehicle.", player )  end 
                else 
                    outputConsole ( "Failed to create trailer.", player ) 
                end 
            else 
                outputConsole ( "You must be in a vehicle if VEHICLEID argument is excluded.", player ) 
            end 
        end 
    end 
end 
  
  
local root = getRootElement () 
local thisResourceRoot = getResourceRootElement(getThisResource()) 
  
function thisResourceStart () 
    outputChatBox ( "Script stunt. Type /stunt for more info. Tapez /stunt pour plus d'info." ) 
    local players = getElementsByType ( "player" ) 
    for k,v in ipairs(players) do 
        bindKey ( v, "=", "down", "Lights on/off", toggleVehicleLights  ) 
        bindKey ( v, "l", "down", "Lock/unlock door", toggleVehicleLock ) 
    end 
end 
  
function playerWasted ( ammo, killer, weapon ) 
    local x, y, z = getElementPosition ( source ) 
    setTimer ( destroyElement, 3000, 1, createBlip ( x, y, z, 0, 2, 255, 255, 255, 170 ) ) 
end       
  
function playerJoin () 
    outputChatBox ( "Script stunt. Type /stunt for more info. Tapez /stunt pour plus d'info.", source ) 
    bindKey ( source, "=", "down", toggleVehicleLights, "Lights on/off" ) 
    bindKey ( source, "l", "down", toggleVehicleLock, "Lock/unlock door" ) 
end 
  
  
function stunt ( command ) 
  outputChatBox ( "/createvehicle - Boutton 'i' (Teleportation) - 'l' (lock his car/son vehicule", playerSource) 
end 
addCommandHandler ( "stunt", stunt ) 
  
  
addEventHandler ( "onResourceStart", thisResourceRoot, thisResourceStart ) 
addEventHandler ( "onPlayerWasted", root, playerWasted ) 
addEventHandler ( "onPlayerJoin", root, playerJoin ) 
addCommandHandler ( "createvehicle", consoleCreateVehicle ) 

but it don't work :?

Link to comment
i have add it in stunt.lua

  
[b]fadeCamera( thePlayer, true)[/b]  
  
function consoleCreateVehicle ( player, commandName, first, second, third ) 
    if ( player ) then 
        local id, x, y, z, r, d = 0, 0, 0, 0, 0, 5 
        local plate = false 
        r = getPlayerRotation ( player ) 
        x, y, z = getElementPosition ( player ) 
        x = x + ( ( math.cos ( math.rad ( r ) ) ) * d ) 
        y = y + ( ( math.sin ( math.rad ( r ) ) ) * d ) 
        if ( third ) then 
            id = getVehicleIDFromName ( first .. " " .. second ) 
            plate = third 
        elseif ( second ) then 
            if ( getVehicleIDFromName ( first .. " " .. second ) ) then 
                id = getVehicleIDFromName ( first .. " " .. second ) 
            else 
                id = getVehicleIDFromName ( first ) 
                if ( not id ) then 
                    id = tonumber ( first ) 
                end 
                plate = second 
            end         
        else 
            id = getVehicleIDFromName ( first ) 
            if ( not id ) then 
                id = tonumber ( first ) 
            end 
        end 
        local veh = false 
        if ( plate == false ) then 
            veh = createVehicle ( id, x, y, z, 0, 0, r ) 
            --toggleVehicleRespawn ( veh, false ) 
        else 
            veh = createVehicle ( id, x, y, z, 0, 0, r, plate ) 
            --toggleVehicleRespawn ( veh, false ) 
        end 
        if ( veh == false ) then  outputConsole ( "Failed to create vehicle.", player )  end 
    end 
end 
  
function consoleAttachTrailer ( player, commandName, trailerid, vehicleid ) 
    if ( player ) then 
        if ( vehicleid ) then 
            local sx, sy, id, x, y, z, r, d = 0, 0, 0, 0, 0, 0, 0, 5 
            r = getPlayerRotation ( player ) 
            sx, sy, z = getElementPosition ( player ) 
            x = sx + ( math.cos ( math.rad ( r ) ) * d ) 
            y = sy + ( math.sin ( math.rad ( r ) ) * d ) 
            local veh = createVehicle ( tonumber ( vehicleid ), x, y, z, 0, 0, r ) 
            x = sx + ( ( math.cos ( math.rad ( r ) ) ) * ( d + 7.5 ) ) 
            y = sy + ( ( math.sin ( math.rad ( r ) ) ) * ( d + 7.5 ) ) 
            local trailer = createVehicle ( tonumber ( trailerid ), x, y, z, 0, 0, r ) 
            if ( veh and trailer ) then 
                --toggleVehicleRespawn ( veh, false ) 
                --toggleVehicleRespawn ( trailer, false ) 
                if ( attachTrailerToVehicle ( veh, trailer ) == false ) then  outputConsole ( "Failed to attach vehicle.", player )  end 
            else 
                outputConsole ( "Failed to create vehicle and/or trailer.", player ) 
            end 
        else            
            if ( isPlayerInVehicle ( player ) ) then 
                local veh = getPlayerOccupiedVehicle ( player ) 
                local sx, sy, id, x, y, z, rx, ry, rz, d = 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.5 
                rx, ry, rz = getVehicleRotation ( veh ) 
                sx, sy, z = getElementPosition ( veh ) 
                x = sx + ( ( math.cos ( math.rad ( rz + 270 ) ) ) * d ) 
                y = sy + ( ( math.sin ( math.rad ( rz + 270 ) ) ) * d ) 
                local trailer = createVehicle ( tonumber ( trailerid ), x, y, z, rx, ry, rz ) 
                if ( trailer ) then 
                    --toggleVehicleRespawn ( trailer, false ) 
                    if ( attachTrailerToVehicle ( veh, trailer ) == false ) then  outputConsole ( "Failed to attach vehicle.", player )  end 
                else 
                    outputConsole ( "Failed to create trailer.", player ) 
                end 
            else 
                outputConsole ( "You must be in a vehicle if VEHICLEID argument is excluded.", player ) 
            end 
        end 
    end 
end 
  
  
local root = getRootElement () 
local thisResourceRoot = getResourceRootElement(getThisResource()) 
  
function thisResourceStart () 
    outputChatBox ( "Script stunt. Type /stunt for more info. Tapez /stunt pour plus d'info." ) 
    local players = getElementsByType ( "player" ) 
    for k,v in ipairs(players) do 
        bindKey ( v, "=", "down", "Lights on/off", toggleVehicleLights  ) 
        bindKey ( v, "l", "down", "Lock/unlock door", toggleVehicleLock ) 
    end 
end 
  
function playerWasted ( ammo, killer, weapon ) 
    local x, y, z = getElementPosition ( source ) 
    setTimer ( destroyElement, 3000, 1, createBlip ( x, y, z, 0, 2, 255, 255, 255, 170 ) ) 
end       
  
function playerJoin () 
    outputChatBox ( "Script stunt. Type /stunt for more info. Tapez /stunt pour plus d'info.", source ) 
    bindKey ( source, "=", "down", toggleVehicleLights, "Lights on/off" ) 
    bindKey ( source, "l", "down", toggleVehicleLock, "Lock/unlock door" ) 
end 
  
  
function stunt ( command ) 
  outputChatBox ( "/createvehicle - Boutton 'i' (Teleportation) - 'l' (lock his car/son vehicule", playerSource) 
end 
addCommandHandler ( "stunt", stunt ) 
  
  
addEventHandler ( "onResourceStart", thisResourceRoot, thisResourceStart ) 
addEventHandler ( "onPlayerWasted", root, playerWasted ) 
addEventHandler ( "onPlayerJoin", root, playerJoin ) 
addCommandHandler ( "createvehicle", consoleCreateVehicle ) 

but it don't work :?

hmm... you dont understand :|

will be

  
  
function consoleCreateVehicle ( player, commandName, first, second, third ) 
    if ( player ) then 
        local id, x, y, z, r, d = 0, 0, 0, 0, 0, 5 
        local plate = false 
        r = getPlayerRotation ( player ) 
        x, y, z = getElementPosition ( player ) 
        x = x + ( ( math.cos ( math.rad ( r ) ) ) * d ) 
        y = y + ( ( math.sin ( math.rad ( r ) ) ) * d ) 
        if ( third ) then 
            id = getVehicleIDFromName ( first .. " " .. second ) 
            plate = third 
        elseif ( second ) then 
            if ( getVehicleIDFromName ( first .. " " .. second ) ) then 
                id = getVehicleIDFromName ( first .. " " .. second ) 
            else 
                id = getVehicleIDFromName ( first ) 
                if ( not id ) then 
                    id = tonumber ( first ) 
                end 
                plate = second 
            end         
        else 
            id = getVehicleIDFromName ( first ) 
            if ( not id ) then 
                id = tonumber ( first ) 
            end 
        end 
        local veh = false 
        if ( plate == false ) then 
            veh = createVehicle ( id, x, y, z, 0, 0, r ) 
            --toggleVehicleRespawn ( veh, false ) 
        else 
            veh = createVehicle ( id, x, y, z, 0, 0, r, plate ) 
            --toggleVehicleRespawn ( veh, false ) 
        end 
        if ( veh == false ) then  outputConsole ( "Failed to create vehicle.", player )  end 
    end 
end 
  
function consoleAttachTrailer ( player, commandName, trailerid, vehicleid ) 
    if ( player ) then 
        if ( vehicleid ) then 
            local sx, sy, id, x, y, z, r, d = 0, 0, 0, 0, 0, 0, 0, 5 
            r = getPlayerRotation ( player ) 
            sx, sy, z = getElementPosition ( player ) 
            x = sx + ( math.cos ( math.rad ( r ) ) * d ) 
            y = sy + ( math.sin ( math.rad ( r ) ) * d ) 
            local veh = createVehicle ( tonumber ( vehicleid ), x, y, z, 0, 0, r ) 
            x = sx + ( ( math.cos ( math.rad ( r ) ) ) * ( d + 7.5 ) ) 
            y = sy + ( ( math.sin ( math.rad ( r ) ) ) * ( d + 7.5 ) ) 
            local trailer = createVehicle ( tonumber ( trailerid ), x, y, z, 0, 0, r ) 
            if ( veh and trailer ) then 
                --toggleVehicleRespawn ( veh, false ) 
                --toggleVehicleRespawn ( trailer, false ) 
                if ( attachTrailerToVehicle ( veh, trailer ) == false ) then  outputConsole ( "Failed to attach vehicle.", player )  end 
            else 
                outputConsole ( "Failed to create vehicle and/or trailer.", player ) 
            end 
        else            
            if ( isPlayerInVehicle ( player ) ) then 
                local veh = getPlayerOccupiedVehicle ( player ) 
                local sx, sy, id, x, y, z, rx, ry, rz, d = 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.5 
                rx, ry, rz = getVehicleRotation ( veh ) 
                sx, sy, z = getElementPosition ( veh ) 
                x = sx + ( ( math.cos ( math.rad ( rz + 270 ) ) ) * d ) 
                y = sy + ( ( math.sin ( math.rad ( rz + 270 ) ) ) * d ) 
                local trailer = createVehicle ( tonumber ( trailerid ), x, y, z, rx, ry, rz ) 
                if ( trailer ) then 
                    --toggleVehicleRespawn ( trailer, false ) 
                    if ( attachTrailerToVehicle ( veh, trailer ) == false ) then  outputConsole ( "Failed to attach vehicle.", player )  end 
                else 
                    outputConsole ( "Failed to create trailer.", player ) 
                end 
            else 
                outputConsole ( "You must be in a vehicle if VEHICLEID argument is excluded.", player ) 
            end 
        end 
    end 
end 
  
  
local root = getRootElement () 
local thisResourceRoot = getResourceRootElement(getThisResource()) 
  
function thisResourceStart () 
    outputChatBox ( "Script stunt. Type /stunt for more info. Tapez /stunt pour plus d'info." ) 
    local players = getElementsByType ( "player" ) 
    for k,v in ipairs(players) do 
        bindKey ( v, "=", "down", "Lights on/off", toggleVehicleLights  ) 
        bindKey ( v, "l", "down", "Lock/unlock door", toggleVehicleLock ) 
        [b]fadeCamera( v, true)[/b] 
    end 
end 
  
function playerWasted ( ammo, killer, weapon ) 
    local x, y, z = getElementPosition ( source ) 
    setTimer ( destroyElement, 3000, 1, createBlip ( x, y, z, 0, 2, 255, 255, 255, 170 ) ) 
end       
  
function playerJoin () 
    outputChatBox ( "Script stunt. Type /stunt for more info. Tapez /stunt pour plus d'info.", source ) 
    bindKey ( source, "=", "down", toggleVehicleLights, "Lights on/off" ) 
    bindKey ( source, "l", "down", toggleVehicleLock, "Lock/unlock door" ) 
    [b]fadeCamera( source, true)[/b] 
end 
  
  
function stunt ( command ) 
  outputChatBox ( "/createvehicle - Boutton 'i' (Teleportation) - 'l' (lock his car/son vehicule", playerSource) 
end 
addCommandHandler ( "stunt", stunt ) 
  
  
addEventHandler ( "onResourceStart", thisResourceRoot, thisResourceStart ) 
addEventHandler ( "onPlayerWasted", root, playerWasted ) 
addEventHandler ( "onPlayerJoin", root, playerJoin ) 
addCommandHandler ( "createvehicle", consoleCreateVehicle ) 

Link to comment

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