-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
waterp = createWater ( 174.3408203125, -1755.365234375, 4.5, 174.3447265625, -1750.3193359375, 4.5, 163.822265625, -1755.3642578125, 4.5, 163.822265625, -1750.3271484375, 4.5 ) if ( waterp ) then setWaterLevel ( waterp, 10 ) else outputChatBox ( "El agua no se creo!" ) end
-
You're using client side tables, functions on a server side script.
-
Learn Lua and MySQL and you'll be able to do it.
-
That's server side, and ALL GUI functions are client side, could you start thinking on what are you doing?
-
What is "addPlayerZombieKills" function supposed to do?
-
Your script is client side or server side?
-
Where is "zombieKills" defined?
-
You should use two functions, one to refresh the players and other to search for a player.
-
Topic moved to "Other Creations" section.
-
That make's no sense, is just a random code. GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} originalPosition = { } rotation = 0 GUIEditor_Window[1] = guiCreateWindow(0.3242,0.6933,0.3477,0.2316,"GUI Skins",true) GUIEditor_Label[1] = guiCreateLabel(101,28,214,18,"Aqui Pones la ID del skin que quieras",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(21,25,75,30,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(21,66,111,32,"Comprar Skin",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(196,66,111,32,"Cancelar",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(17,111,323,16,"El Costo de este Skin es el siguiente : 15000 ",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,255,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Window[2] = guiCreateWindow(0.3594,0.295,0.291,0.2167,"GUI Confirmacion de Cambio de Skin",true) guiWindowSetMovable(GUIEditor_Window[2],false) guiWindowSetSizable(GUIEditor_Window[2],false) guiSetVisible( GUIEditor_Window[2], false) GUIEditor_Label[3] = guiCreateLabel(39,26,207,14,"Seguro que quieres cambiar tu skin ?",false,GUIEditor_Window[2]) guiLabelSetColor(GUIEditor_Label[3],255,255,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Button[3] = guiCreateButton(9,82,63,29,"Si",false,GUIEditor_Window[2]) GUIEditor_Button[4] = guiCreateButton(206,82,63,29,"No",false,GUIEditor_Window[2]) guiSetVisible( GUIEditor_Window[1], false) showCursor(false) ------------------------------------ ---TheMarker------------------------ marker = createMarker ( 1654.16162, -1661.63123, 21.9, "cylinder", 2, 100, 0, 255, 100 ) createBlipAttachedTo ( marker, 45 ) function warp ( ) setElementPosition ( localPlayer, 1651, -1661.63123, 21.9 ) end addCommandHandler ( "setpos", warp ) ------------------------------------ ---TheFunctions--------------------- function markerHit ( hitPlayer ) if ( hitPlayer == localPlayer and source == marker ) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) removeEventHandler ( "onClientRender", root, rotateTempPed ) triggerServerEvent ( "cm", getLocalPlayer() ) setElementDimension( localPlayer, 2 ) ped = createPed ( tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) or 0, 1654.16162, -1661.63123, 21.9 ) -- If no skin was given, it'll create it with CJ skin. if ( ped ) then addEventHandler ( "onClientRender", root, rotateTempPed ) setElementFrozen ( ped, true ) setElementDimension( ped, 2 ) setElementAlpha( localPlayer, 0 ) end end end addEventHandler ( "onClientMarkerHit", root, markerHit ) function botton ( ) if source == GUIEditor_Button[2] then originalPosition = { getElementPosition ( localPlayer ) } guiSetVisible( GUIEditor_Window[1], false) guiSetVisible( GUIEditor_Window[2], false) showCursor(false) setCameraTarget( localPlayer ) setElementDimension( localPlayer, 0 ) setElementFrozen ( localPlayer, false ) setElementPosition ( localPlayer, unpack ( originalPosition ) ) setElementAlpha ( localPlayer, 255 ) elseif source == GUIEditor_Button[1] then guiSetVisible( GUIEditor_Window[1], false) guiSetVisible( GUIEditor_Window[2], true) showCursor(true) elseif source == GUIEditor_Button[4] then guiSetVisible( GUIEditor_Window[1], true ) guiSetVisible( GUIEditor_Window[2], false ) showCursor(true) elseif source == GUIEditor_Button[3] then setCameraTarget( localPlayer ) guiSetVisible( GUIEditor_Window[1], false ) guiSetVisible( GUIEditor_Window[2], false ) showCursor(false) setElementDimension( localPlayer, 0 ) setElementAlpha( localPlayer, 255 ) local money = getPlayerMoney( localPlayer ) if ( money >= 15000 ) then triggerServerEvent("qtm", getLocalPlayer() ) setElementModel( localPlayer, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) ) else outputChatBox( " Para Comprarte este skin necesitas $15000 y tu dinero es ".. money .." " ) end end end addEventHandler ( "onClientGUIClick", root, botton ) addEventHandler ( "onClientGUIChanged", GUIEditor_Edit[1], function ( ) local skin = guiGetText ( source ) if ( isElement ( ped ) ) then setElementModel ( ped, tonumber ( skin ) or 0 ) end end ) function destruir ( matchingDimension ) if ( localPlayer and source == marker ) then if isElement ( ped ) then destroyElement ( ped ) removeEventHandler ( "onClientRender", root, rotateTempPed ) end end end addEventHandler ( "onClientMarkerLeave", root, destruir ) function rotateTempPed ( ) if isElement ( ped ) then -- If the ped exists rotation = rotation + 1 -- Increase the variable "rotation" by 1. if ( rotation > 359 ) then -- If the rotation is higher to 359 rotation = 0 -- Set the rotation back to 0. end setPedRotation ( ped, rotation ) -- Set the ped rotation to variable "rotation". end end This is the last thing I make for you, because I see that you're not really learning anything, you keep posting random code and ask for a fix.
-
First line is useless. You should check if the ped exists, also, you're just setting the rotation to 180 always.
-
Well, you could use onClientRender combined with getPedRotation, setPedRotation.
-
You want to slowly rotate the ped?
-
I don't understand what do you mean.
-
You must use: setPedRotation.
-
I've added something to set the skin when you write it: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} originalPosition = { } GUIEditor_Window[1] = guiCreateWindow(0.3242,0.6933,0.3477,0.2316,"GUI Skins",true) GUIEditor_Label[1] = guiCreateLabel(101,28,214,18,"Aqui Pones la ID del skin que quieras",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(21,25,75,30,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(21,66,111,32,"Comprar Skin",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(196,66,111,32,"Cancelar",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(17,111,323,16,"El Costo de este Skin es el siguiente : 15000 ",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,255,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Window[2] = guiCreateWindow(0.3594,0.295,0.291,0.2167,"GUI Confirmacion de Cambio de Skin",true) guiWindowSetMovable(GUIEditor_Window[2],false) guiWindowSetSizable(GUIEditor_Window[2],false) guiSetVisible( GUIEditor_Window[2], false) GUIEditor_Label[3] = guiCreateLabel(39,26,207,14,"Seguro que quieres cambiar tu skin ?",false,GUIEditor_Window[2]) guiLabelSetColor(GUIEditor_Label[3],255,255,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Button[3] = guiCreateButton(9,82,63,29,"Si",false,GUIEditor_Window[2]) GUIEditor_Button[4] = guiCreateButton(206,82,63,29,"No",false,GUIEditor_Window[2]) guiSetVisible( GUIEditor_Window[1], false) showCursor(false) ------------------------------------ ---TheMarker------------------------ marker = createMarker ( 1654.16162, -1661.63123, 21.9, "cylinder", 2, 100, 0, 255, 100 ) createBlipAttachedTo ( marker, 45 ) function warp ( ) setElementPosition ( localPlayer, 1651, -1661.63123, 21.9 ) end addCommandHandler ( "setpos", warp ) ------------------------------------ ---TheFunctions--------------------- function markerHit ( hitPlayer ) if ( hitPlayer == localPlayer and source == marker ) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) triggerServerEvent ( "cm", getLocalPlayer() ) setElementDimension( localPlayer, 2 ) ped = createPed ( tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) or 0, 1654.16162, -1661.63123, 21.9 ) -- If no skin was given, it'll create it with CJ skin. if ( ped ) then setElementFrozen ( ped, true ) setElementDimension( ped, 2 ) setElementAlpha( localPlayer, 0 ) end end end addEventHandler ( "onClientMarkerHit", root, markerHit ) function botton ( ) if source == GUIEditor_Button[2] then originalPosition = { getElementPosition ( localPlayer ) } guiSetVisible( GUIEditor_Window[1], false) guiSetVisible( GUIEditor_Window[2], false) showCursor(false) setCameraTarget( localPlayer ) setElementDimension( localPlayer, 0 ) setElementFrozen ( localPlayer, false ) setElementPosition ( localPlayer, unpack ( originalPosition ) ) setElementAlpha ( localPlayer, 255 ) elseif source == GUIEditor_Button[1] then guiSetVisible( GUIEditor_Window[1], false) guiSetVisible( GUIEditor_Window[2], true) showCursor(true) elseif source == GUIEditor_Button[4] then guiSetVisible( GUIEditor_Window[1], true ) guiSetVisible( GUIEditor_Window[2], false ) showCursor(true) elseif source == GUIEditor_Button[3] then setCameraTarget( localPlayer ) guiSetVisible( GUIEditor_Window[1], false ) guiSetVisible( GUIEditor_Window[2], false ) showCursor(false) setElementDimension( localPlayer, 0 ) setElementAlpha( localPlayer, 255 ) local money = getPlayerMoney( localPlayer ) if ( money >= 15000 ) then triggerServerEvent("qtm", getLocalPlayer() ) setElementModel( localPlayer, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) ) else outputChatBox( " Para Comprarte este skin necesitas $15000 y tu dinero es ".. money .." " ) end end end addEventHandler ( "onClientGUIClick", root, botton ) addEventHandler ( "onClientGUIChanged", GUIEditor_Edit[1], function ( ) local skin = guiGetText ( source ) if ( isElement ( ped ) ) then setElementModel ( ped, tonumber ( skin ) or 0 ) end end ) function destruir ( matchingDimension ) if ( localPlayer and source == marker ) then if isElement ( ped ) then destroyElement ( ped ) end end end addEventHandler ( "onClientMarkerLeave", root, destruir )
-
No, you didn't get me right, I mean set a timer at setElementModel. function a ( ) camara = setCameraMatrix ( source, 1654.2763671875, -1670.05078125, 21.4375, 1654.16162, -1661.63123, 21.9 ) setElementDimension( source, 2 ) end addEvent ( "cm", true ) addEventHandler ( "cm", root, a ) function e ( ) local money = getPlayerMoney ( source ) if ( money >= 15000 ) then takePlayerMoney ( source, 15000 ) else outputChatBox ( " tu Dinero es ".. money .." y necesitas $15000 para comprarte un skin." ) end end addEvent ( "qtm", true ) addEventHandler ( "qtm", root, e ) function playerQuits ( ) local playeraccount = getPlayerAccount ( source ) -- get the player's account if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if the player is logged in local skin = getElementModel ( source ) -- get the player skin. setAccountData ( playeraccount, "skin", skin ) -- save current skin to account end end addEventHandler ( "onPlayerQuit", root, playerQuits ) function playerLogin ( _, playeraccount ) -- player logs in if ( playeraccount ) then -- if account that he logged into, exists local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata if ( skin ) then -- if he has skin accountdata setElementModel ( source, tonumber ( skin ) ) -- give him the skin end end end addEventHandler ( "onPlayerLogin", root, playerLogin ) function playerSpawns ( ) -- called when a player spawns local playeraccount = getPlayerAccount ( source ) -- get the player's account if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if he's logged in on an account local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata if ( skin ) then -- if he has skin accountdata setTimer ( setElementModel, 2000, 1, source, tonumber ( skin ) ) -- give him the skin end end end addEventHandler ( "onPlayerSpawn", root, playerSpawns ) -- when player spawns, call playerSpawns function
-
This works for me: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} originalPosition = { } GUIEditor_Window[1] = guiCreateWindow(0.3242,0.6933,0.3477,0.2316,"GUI Skins",true) GUIEditor_Label[1] = guiCreateLabel(101,28,214,18,"Aqui Pones la ID del skin que quieras",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(21,25,75,30,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(21,66,111,32,"Comprar Skin",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(196,66,111,32,"Cancelar",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(17,111,323,16,"El Costo de este Skin es el siguiente : 15000 ",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,255,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Window[2] = guiCreateWindow(0.3594,0.295,0.291,0.2167,"GUI Confirmacion de Cambio de Skin",true) guiWindowSetMovable(GUIEditor_Window[2],false) guiWindowSetSizable(GUIEditor_Window[2],false) guiSetVisible( GUIEditor_Window[2], false) GUIEditor_Label[3] = guiCreateLabel(39,26,207,14,"Seguro que quieres cambiar tu skin ?",false,GUIEditor_Window[2]) guiLabelSetColor(GUIEditor_Label[3],255,255,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Button[3] = guiCreateButton(9,82,63,29,"Si",false,GUIEditor_Window[2]) GUIEditor_Button[4] = guiCreateButton(206,82,63,29,"No",false,GUIEditor_Window[2]) guiSetVisible( GUIEditor_Window[1], false) showCursor(false) ------------------------------------ ---TheMarker------------------------ marker = createMarker ( 1654.16162, -1661.63123, 21.9, "cylinder", 2, 100, 0, 255, 100 ) createBlipAttachedTo ( marker, 45 ) function warp ( ) setElementPosition ( localPlayer, 1651, -1661.63123, 21.9 ) end addCommandHandler ( "setpos", warp ) ------------------------------------ ---TheFunctions--------------------- function markerHit ( hitPlayer ) if ( hitPlayer == localPlayer and source == marker ) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) triggerServerEvent ( "cm", getLocalPlayer() ) setElementDimension( localPlayer, 2 ) ped = createPed ( tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) or 0, 1654.16162, -1661.63123, 21.9 ) -- If no skin was given, it'll create it with CJ skin. if ( ped ) then setElementFrozen ( ped, true ) setElementDimension( ped, 2 ) setElementAlpha( localPlayer, 0 ) end end end addEventHandler ( "onClientMarkerHit", root, markerHit ) function botton ( ) if source == GUIEditor_Button[2] then originalPosition = { getElementPosition ( localPlayer ) } guiSetVisible( GUIEditor_Window[1], false) guiSetVisible( GUIEditor_Window[2], false) showCursor(false) setCameraTarget( localPlayer ) setElementDimension( localPlayer, 0 ) setElementFrozen ( localPlayer, false ) setElementPosition ( localPlayer, unpack ( originalPosition ) ) setElementAlpha ( localPlayer, 255 ) elseif source == GUIEditor_Button[1] then guiSetVisible( GUIEditor_Window[1], false) guiSetVisible( GUIEditor_Window[2], true) showCursor(true) elseif source == GUIEditor_Button[4] then guiSetVisible( GUIEditor_Window[1], true ) guiSetVisible( GUIEditor_Window[2], false ) showCursor(true) elseif source == GUIEditor_Button[3] then setCameraTarget( localPlayer ) guiSetVisible( GUIEditor_Window[1], false ) guiSetVisible( GUIEditor_Window[2], false ) showCursor(false) setElementDimension( localPlayer, 0 ) setElementAlpha( localPlayer, 255 ) local money = getPlayerMoney( localPlayer ) if ( money >= 15000 ) then triggerServerEvent("qtm", getLocalPlayer() ) setElementModel( localPlayer, tonumber ( guiGetText ( GUIEditor_Edit[1] ) ) ) else outputChatBox( " Para Comprarte este skin necesitas $15000 y tu dinero es ".. money .." " ) end end end addEventHandler ( "onClientGUIClick", root, botton ) function destruir ( matchingDimension ) if ( localPlayer and source == marker ) then if isElement ( ped ) then destroyElement ( ped ) end end end addEventHandler ( "onClientMarkerLeave", root, destruir )
-
Set a timer to set the skin, e.g 2 seconds after spawn set the new skin.
-
function a ( ) camara = setCameraMatrix ( source, 1654.2763671875, -1670.05078125, 21.4375, 1654.16162, -1661.63123, 21.9 ) setElementDimension( source, 2 ) end addEvent ( "cm", true ) addEventHandler ( "cm", root, a ) function e ( ) local money = getPlayerMoney ( source ) if ( money >= 15000 ) then takePlayerMoney ( source, 15000 ) else outputChatBox ( " tu Dinero es ".. money .." y necesitas $15000 para comprarte un skin." ) end end addEvent ( "qtm", true ) addEventHandler ( "qtm", root, e ) function playerQuits ( ) local playeraccount = getPlayerAccount ( source ) -- get the player's account if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if the player is logged in local skin = getElementModel ( source ) -- get the player skin. setAccountData ( playeraccount, "skin", skin ) -- save current skin to account end end addEventHandler ( "onPlayerQuit", root, playerQuits ) function playerLogin ( _, playeraccount ) -- player logs in if ( playeraccount ) then -- if account that he logged into, exists local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata if ( skin ) then -- if he has skin accountdata setElementModel ( source, tonumber ( skin ) ) -- give him the skin end end end addEventHandler ( "onPlayerLogin", root, playerLogin ) function playerSpawns ( ) -- called when a player spawns local playeraccount = getPlayerAccount ( source ) -- get the player's account if ( playeraccount ) and ( not isGuestAccount ( playeraccount ) ) then -- if he's logged in on an account local skin = getAccountData ( playeraccount, "skin" ) -- get skin accountdata if ( skin ) then -- if he has skin accountdata setElementModel ( source, tonumber ( skin ) ) -- give him the skin end end end addEventHandler ( "onPlayerSpawn", root, playerSpawns ) -- when player spawns, call playerSpawns function
-
Post the rest of your code.
-
Off topic: Maybe you made too much enemies with your old account?