-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
What's wrong with changing the handling?
-
Well, you can make it trigger an event to the server side, then you check on the server side if the player is admin, and then you trigger back to the client side to show the GUI.
-
Here: setVehicleHandling ( hitElement, "maxVelocity", value )
-
--server local marker = createMarker ( 2784, 1267.4000244141, 10.60000038147, "cylinder", 2, 0, 0, 0, 170 ) addEventHandler ( "onMarkerHit", marker, function ( player ) if ( getElementType ( player ) == "player" ) then if ( getElementData ( player, "Group" ) ~= "GHOST" ) then outputChatBox ( "#FF0000* #FFF000Only For #FF0000 .:[GHOST]:. #FFF000Group ", player, 255, 255, 0, true ) else outputChatBox ( "#FF0000* #FFF000Your Skin Changed .", player, 255, 255, 0, true ) setElementModel ( player, 299 ) end end end )
-
addCommandHandler ( "carpaint", function ( ) if isElement ( myShader ) then engineRemoveShaderFromWorldTexture ( myShader, "vehiclegrunge256" ) engineRemoveShaderFromWorldTexture ( myShader, "?emap*" ) destroyElement ( myShader ) if isElement ( textureVol ) then destroyElement ( textureVol ) end if isElement ( textureCube ) then destroyElement ( textureCube ) end return end -- Version check if ( getVersion ( ).sortable < "1.1.0" ) then outputChatBox ( "Resource is not compatible with this client." ) return end -- Create shader myShader, tex = dxCreateShader ( "car_paint.fx" ) if ( not myShader ) then outputChatBox ( "Could not create shader. Please use debugscript 3" ) else outputChatBox ( "Using technique ".. tex ) -- Set textures textureVol = dxCreateTexture ( "images/smallnoise3d.dds" ); textureCube = dxCreateTexture ( "images/cube_env256.dds" ); dxSetShaderValue ( myShader, "sRandomTexture", textureVol ); dxSetShaderValue ( myShader, "sReflectionTexture", textureCube ); engineApplyShaderToWorldTexture ( myShader, "vehiclegrunge256" ) engineApplyShaderToWorldTexture ( myShader, "?emap*" ) end end ) Try that.
-
That event is triggered after all the players are dead and just 1 is alive. You can use onRacePlayerWasted and check their rank.
-
We don't give support with leaked scripts.
-
You've got an error there, it's "addEventHandler" not "addEventhandler":
-
Well, for what it seems is that the IP you entered is not allowed.
-
That function is not a native MTA function.
-
if isElement ( elementWeaponBack [ source ] ) then destroyElement ( elementWeaponBack [ source ] ) end
-
Are you sure? because it should work.
-
Where is takePlayerMoney?
-
You put it vice versa, put first 'source' and the amount after. Also, you can do it with just one event, just send the amount from client side.
-
local shootTimer = nil function shoot( thePlayer ) local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then local vehicle = getPedOccupiedVehicle(thePlayer) if vehicle then if not (isTimer(shootTimer)) then local posX, posY, posZ = getElementPosition(vehicle) shootTimer = setTimer(function()end, 3333, 1) triggerClientEvent ( "createProjectileServer", getRootElement(), vehicle, 19, posX, posY, posZ, 1.0) end end end end function bindOnJoin() bindKey(source, "vehicle_fire", "down", shoot) bindKey(source, "vehicle_secondary_fire", "down", shoot) end addEventHandler("onPlayerJoin", root, bindOnJoin) function bindOnStart() for index, thePlayer in pairs(getElementsByType("player")) do bindKey(thePlayer, "vehicle_fire", "down", shoot) bindKey(thePlayer, "vehicle_secondary_fire", "down", shoot) end end addEventHandler("onResourceStart", getResourceRootElement(), bindOnStart)
-
takePlayerMoney isn't meant to be used client side, since the money won't be synchronized, you have to take it server side.
-
local lp = getLocalPlayer ( ) local marker = createMarker ( 2043, 1557, 10, "cylinder", 2.0, 0, 0, 255, 0 ) local ped = createPed ( 59, 2043, 1557, 10 ) createBlipAttachedTo ( marker, 25 ) sx, sy = guiGetScreenSize () win = guiCreateWindow(282, 212, 462, 285, "Drug Dealer Job Description", false) guiWindowSetSizable(win, false) buttonCancel = guiCreateButton(49, 236, 119, 39, "Cancel", false, win) buttonAccept = guiCreateButton(270, 236, 119, 39, "Accept", false, win) memoOne = guiCreateMemo(9, 24, 443, 206, "Spawn a boat and go to the marker on your map. Buy some drugs and go to the next marker to sell your drugs.", false, win) guiMemoSetReadOnly(memoOne, true) guiSetVisible ( win, false ) drugsWindow = guiCreateWindow(328, 235, 455, 304, "Drugs Market", false) guiWindowSetSizable(drugsWindow, false) gridList = guiCreateGridList(9, 25, 429, 216, false, drugsWindow) guiGridListAddColumn(gridList, "Drug", 0.3) guiGridListAddColumn(gridList, "Buy for", 0.3) guiGridListAddColumn(gridList, "Sell for", 0.3) for i = 1, 5 do guiGridListAddRow(gridList) end meth = guiGridListSetItemText(gridList, 0, 1, "Meth", false, false) guiGridListSetItemText(gridList, 0, 2, "$500,000", false, false) guiGridListSetItemText(gridList, 0, 3, "$750,000", false, false) cocaine = guiGridListSetItemText(gridList, 1, 1, "Cocaine", false, false) guiGridListSetItemText(gridList, 1, 2, "$50,000", false, false) guiGridListSetItemText(gridList, 1, 3, "$100,000", false, false) heroin = guiGridListSetItemText(gridList, 2, 1, "Heroin", false, false) guiGridListSetItemText(gridList, 2, 2, "$25,000", false, false) guiGridListSetItemText(gridList, 2, 3, "$40,000", false, false) ecstasy = guiGridListSetItemText(gridList, 3, 1, "Ecstasy", false, false) guiGridListSetItemText(gridList, 3, 2, "$15,000", false, false) guiGridListSetItemText(gridList, 3, 3, "$25,000", false, false) marijuana = guiGridListSetItemText(gridList, 4, 1, "Marijuana", false, false) guiGridListSetItemText(gridList, 4, 2, "$5,000", false, false) guiGridListSetItemText(gridList, 4, 3, "$7,500", false, false) guiGridListSetSelectionMode ( gridlist, 0 ) buttonCancelTwo = guiCreateButton(38, 247, 118, 47, "Cancel", false, drugsWindow) buttonBuy = guiCreateButton(263, 247, 118, 47, "Buy", false, drugsWindow) guiSetVisible ( drugsWindow, false ) function openGUI ( p ) if ( getElementType ( p ) ~= 'player' or p ~= localPlayer ) then return end if ( getElementModel (lp) ) == 59 then outputChatBox ( "You already have this job", 255, 0, 0 ) return end guiSetVisible ( win, true ) showCursor ( true ) end addEventHandler("onClientMarkerHit", marker, openGUI ) addEventHandler ("onClientGUIClick",root, function () if (source == buttonCancel ) then guiSetVisible ( win, false ) showCursor ( false ) elseif (source == buttonAccept ) then guiSetVisible ( win, false ) showCursor ( false ) triggerServerEvent ("setTeam", lp) setElementModel ( lp, 59 ) drugsMarker = createMarker ( 2048, 1584, 10, "cylinder", 2.0, 255, 0, 0, 255 ) createBlipAttachedTo ( drugsMarker, 41, 2, 255, 0, 0, 255, 0, 65535 ) addEventHandler("onClientMarkerHit", drugsMarker, openDrugsGUI ) end end ) function invPed() cancelEvent() end addEventHandler("onClientPedDamage", ped, invPed) function openDrugsGUI ( p ) if ( getElementType ( p ) == "player" and p == lp ) then guiSetVisible ( drugsWindow, true ) showCursor ( true ) end end addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == buttonCancelTwo ) then guiSetVisible ( win, false ) showCursor ( false ) elseif ( source == buttonBuy ) then guiSetVisible ( win, false ) showCursor ( false ) outputChatBox ( "Go to the marker to sell your drugs" ) destroyElement ( drugsMarker ) drugBought = guiGridListGetSelectedItem ( gridList ) if ( drugBought == meth ) then if ( getPlayerMoney ( ) >= 500000 ) then takePlayerMoney ( 500000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == Cocaine ) then if ( getPlayerMoney ( ) >= 50000 ) then takePlayerMoney ( 50000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == heroin ) then if ( getPlayerMoney ( ) >= 25000 ) then takePlayerMoney ( 25000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == ecstasy ) then if ( getPlayerMoney ( ) >= 15000 ) then takePlayerMoney ( 15000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == marijuana ) then if ( getPlayerMoney ( ) >= 5000 ) then takePlayerMoney ( 5000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end end end end )
-
And for the other error, just remove 'source' from the function name, here: function takejob (source)
-
local lp = getLocalPlayer ( ) local marker = createMarker ( 2043, 1557, 10, "cylinder", 2.0, 0, 0, 255, 0 ) local ped = createPed ( 59, 2043, 1557, 10 ) createBlipAttachedTo ( marker, 25 ) sx, sy = guiGetScreenSize () win = guiCreateWindow(282, 212, 462, 285, "Drug Dealer Job Description", false) guiWindowSetSizable(win, false) buttonCancel = guiCreateButton(49, 236, 119, 39, "Cancel", false, win) buttonAccept = guiCreateButton(270, 236, 119, 39, "Accept", false, win) memoOne = guiCreateMemo(9, 24, 443, 206, "Spawn a boat and go to the marker on your map. Buy some drugs and go to the next marker to sell your drugs.", false, win) guiMemoSetReadOnly(memoOne, true) guiSetVisible ( win, false ) drugsWindow = guiCreateWindow(328, 235, 455, 304, "Drugs Market", false) guiWindowSetSizable(drugsWindow, false) gridList = guiCreateGridList(9, 25, 429, 216, false, drugsWindow) guiGridListAddColumn(gridList, "Drug", 0.3) guiGridListAddColumn(gridList, "Buy for", 0.3) guiGridListAddColumn(gridList, "Sell for", 0.3) for i = 1, 5 do guiGridListAddRow(gridList) end meth = guiGridListSetItemText(gridList, 0, 1, "Meth", false, false) guiGridListSetItemText(gridList, 0, 2, "$500,000", false, false) guiGridListSetItemText(gridList, 0, 3, "$750,000", false, false) cocaine = guiGridListSetItemText(gridList, 1, 1, "Cocaine", false, false) guiGridListSetItemText(gridList, 1, 2, "$50,000", false, false) guiGridListSetItemText(gridList, 1, 3, "$100,000", false, false) heroin = guiGridListSetItemText(gridList, 2, 1, "Heroin", false, false) guiGridListSetItemText(gridList, 2, 2, "$25,000", false, false) guiGridListSetItemText(gridList, 2, 3, "$40,000", false, false) ecstasy = guiGridListSetItemText(gridList, 3, 1, "Ecstasy", false, false) guiGridListSetItemText(gridList, 3, 2, "$15,000", false, false) guiGridListSetItemText(gridList, 3, 3, "$25,000", false, false) marijuana = guiGridListSetItemText(gridList, 4, 1, "Marijuana", false, false) guiGridListSetItemText(gridList, 4, 2, "$5,000", false, false) guiGridListSetItemText(gridList, 4, 3, "$7,500", false, false) guiGridListSetSelectionMode ( gridlist, 0 ) buttonCancelTwo = guiCreateButton(38, 247, 118, 47, "Cancel", false, drugsWindow) buttonBuy = guiCreateButton(263, 247, 118, 47, "Buy", false, drugsWindow) guiSetVisible ( drugsWindow, false ) function openGUI ( p ) if ( getElementType ( p ) ~= 'player' or p ~= localPlayer ) then return end if ( getElementModel (lp) ) == 59 then outputChatBox ( "You already have this job", 255, 0, 0 ) return end guiSetVisible ( win, true ) showCursor ( true ) end addEventHandler("onClientMarkerHit", marker, openGUI ) addEventHandler ("onClientGUIClick",root, function () if (source == buttonCancel ) then guiSetVisible ( win, false ) showCursor ( false ) elseif (source == buttonAccept ) then guiSetVisible ( win, false ) showCursor ( false ) triggerServerEvent ("setTeam", lp) setElementModel ( lp, 59 ) drugsMarker = createMarker ( 2048, 1584, 10, "cylinder", 2.0, 255, 0, 0, 255 ) createBlipAttachedTo ( drugsMarker, 41, 2, 255, 0, 0, 255, 0, 65535 ) addEventHandler("onClientMarkerHit", drugsMarker, openDrugsGUI ) end end ) function invPed() cancelEvent() end addEventHandler("onClientPedDamage", ped, invPed) function openDrugsGUI ( p ) if ( getElementType ( p ) == "player" and p == lp ) then guiSetVisible ( drugsWindow, true ) showCursor ( true ) end end addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == buttonCancelTwo ) then guiSetVisible ( win, false ) showCursor ( false ) elseif ( source == buttonBuy ) then guiSetVisible ( win, false ) showCursor ( false ) outputChatBox ( "Go to the marker to sell your drugs" ) destroyElement ( drugsMarker ) drugBought = guiGridListGetSelectedItem ( gridList ) if ( drugBought == meth ) then if ( getPlayerMoney ( ) >= 500000 ) then takePlayerMoney ( 500000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end end elseif ( drugBought == Cocaine ) then if ( getPlayerMoney ( ) >= 50000 ) then takePlayerMoney ( 50000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == heroin ) then if ( getPlayerMoney ( ) >= 25000 ) then takePlayerMoney ( 25000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == ecstasy ) then if ( getPlayerMoney ( ) >= 15000 ) then takePlayerMoney ( 15000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == marijuana ) then if ( getPlayerMoney ( ) >= 5000 ) then takePlayerMoney ( 5000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end end end )
-
Podes hacer una query para obtener la ID y asi asignarsela.
-
I've tested the code and the table was created.
-
Add a check to see if the element exists, use isElement