Jump to content

Davision

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by Davision

  1. 19 minutes ago, Best-Killer said:

    you can save the stats with sql or    SetAccountData , GetAccountData

     

    example : 

    
    function test (p)
    testss = "we got the data !!"
    playeraccount = getPlayerAccount(p)
    if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in
    setAccountData (playeraccount,"name",testss)
    end
    end
    addEventHandler("onPlayerLogin",test)
    function test1 (_, playeraccount )
     if ( playeraccount ) then
    local balalbalbal = getAccountData ( playeraccount, "name" )
    if (balalbalbal) then 
    outputChatBox ("data = "..balalbalbal.."")
    end
    end
    end
    addEventHandler ( "onPlayerQuit", getRootElement ( ), test1 )
    addEventHandler("onPlayerLogout",test1)
    

    this just example with other stuff .... it's not with pedstats :) Good luck

    how with SQL ,?

  2. Hey Guys

    when i reconnect or i type /kill the weapon back to the current Stats (Minimum stats )

    Spoiler
    
    local asd = getPlayerMoney(thePlayer)
    
    
    addCommandHandler("upstats", function (thePlayer)
    	for _, stat in ipairs({ 69, 70, 71, 72, 74, 75, 76, 77, 78, 79 }) do
    		if ( getPlayerMoney ( thePlayer ) < 1250 ) then
    			return exports.SACGMessages:sendClientMessage ( "You don't have enough money to buy a stats", thePlayer, 0, 255, 0 )
    		end
    	  takePlayerMoney( thePlayer, "125", asd )
          setPedStat(thePlayer, stat, 1000)
    	  end
    		exports.sacgmessages:sendClientMessage ("Your weapon stats upgraded to maximum! (1250$)", thePlayer, 0, 255, 0, false)
    end)
    
    addCommandHandler("delstats", function(thePlayer)
    	for _, stat in ipairs({ 69, 70, 71, 72, 74, 75, 76, 77, 78, 79 }) do
          setPedStat(thePlayer, stat, 1000)
    		end
    		exports.sacgmessages:sendClientMessage ("Your weapon stats upgraded to minimum!", thePlayer, 0, 255, 0, false)
    end)
    addEventHandler("onPlayerWasted", root, function()
        refreshPlayerWeapons(source)
    end)
    
    addEventHandler("onPlayerSpawn", root, function()
    	if not playerWeapons[source] then return end
    	setTimer(function(player)
    		if not isElement(player) then return end
    		for weapon, tbl in pairs(playerWeapons[player]) do
    			giveWeapon(player, weapon, 1, tbl.inUsing)
    			setWeaponAmmo(player, weapon, tbl.ammo, tbl.inClip)
    		end
    	end, 200, 1, source)
    end)
    
    addEventHandler("onPlayerQuit", root, function()
    	refreshPlayerWeapons(source)
    	local account = getPlayerAccount(source)
    	if isGuestAccount(account) then return false end
    	onQuit(account, playerWeapons[source])
    end)
    
    addEventHandler("onPlayerLogout", root, function(account)
    	refreshPlayerWeapons(source)
    	if isGuestAccount(account) then return false end
    	onQuit(account, playerWeapons[source])
    	takeAllWeapons(source)
    end)

     

    help me plizz

  3. okay.

    local sx, sy  = guiGetScreenSize ( )
    local rsx, rsy = sx / 1280, sy / 1024
    local window = guiCreateWindow( ( sx / 2 - ( rsx*354 ) / 2 ), ( sy / 2 - (rsy*400) / 2 ), (rsx*354), (rsy*400), "SACG:RPG Vehicle", false)
    local vehList = guiCreateGridList((rsx*9), (rsy*26), (rsx*335), (rsy*315), false, window)
    local btnSpawn = guiCreateButton((rsx*9), (rsy*346), (rsx*149), (rsy*43), "Spawn", false, window)
    local btnClose = guiCreateButton((rsx*195), (rsy*346), (rsx*149), (rsy*43), "Cancel", false, window)
    guiWindowSetSizable(window, false)
    guiSetVisible ( window, false )
    guiGridListAddColumn(vehid, "id", 0.9)
    guiGridListAddColumn(vehList, "Vehicle", 0.9)
    local marker = nil
    addEvent ( "SACGSpawners:ShowClientSpawner", true )
    addEventHandler ( "SACGSpawners:ShowClientSpawner", root, function ( cars, mrker )
    	if ( wasEventCancelled ( ) ) then	
    		return
    	end
    	
    	if ( not guiGetVisible ( window ) ) then 
    		bindKey  ( "mouse_wheel_down", "down", spawnClickingFunctions )
    		showCursor ( true )
    		guiSetVisible ( window, true )
    		guiGridListClear ( vehList )
    		addEventHandler ( 'onClientMarkerLeave', mrker, closeWindow )
    		marker = mrker
    		job = getElementData ( marker, "SACGVehicles:JobRestriction" )
    		guiGridListSetItemText ( vehList, guiGridListAddRow ( vehList ), 1, "Free Vehicles", true, true )
    		for i, v in ipairs ( cars ) do
    			local name = getVehicleNameFromModel ( v )
    			local row = guiGridListAddRow ( vehList )
    			guiGridListSetItemText ( vehList, row, 1, name, false, false )
    			guiGridListSetItemData ( vehList, row, 1, v )
    		end
    		
    		if ( exports.SACGVIP:isPlayerVIP ( ) ) then
    			local level = exports.SACGVIP:getVipLevelFromName ( getElementData ( localPlayer, "VIP" ) )
    			if ( level and level > 0 and VipVehicles [ level ] and #VipVehicles [ level ] > 0 ) then
    				guiGridListSetItemText ( vehList, guiGridListAddRow ( vehList ), 1, "VIP Vehicles", true, true )
    				for i, v in pairs ( VipVehicles [ level ] ) do
    					local name = getVehicleNameFromModel ( v )
    					local row = guiGridListAddRow ( vehList )
    					guiGridListSetItemText ( vehList, row, 1, name, false, false )
    					guiGridListSetItemData ( vehList, row, 1, v )
    				end
    			end
    		end
    		
    		guiGridListSetSelectedItem ( vehList, 0, 1 )
    		addEventHandler ( "onClientGUIClick", btnSpawn, spawnClickingFunctions )
    		addEventHandler ( "onClientGUIClick", btnClose, spawnClickingFunctions )
    	end
    end )
    
    
    function spawnClickingFunctions ( )
    	if ( source == btnClose ) then
    		closeWindow ( localPlayer )
    	elseif ( source == btnSpawn ) or getKeyState( "num_1" ) == true then
    		local row, col = guiGridListGetSelectedItem ( vehList )
    		if ( row == -1 ) then
    			return exports['SACGMessages']:sendClientMessage ( "Select a vehicle to be spawn.", 255, 255, 0 )
    		end
    		
    					addEventHandler( "onClientKey", root, function(button,press) 
        -- Since mouse_wheel_up and mouse_wheel_down cant return a release, we dont have to check the press.
        if button == "mouse_wheel_up" or button == "mouse_wheel_down" then
            outputDebugString( button .. " moved." )
            return true
        end
        return false
    end )
    		
    		local id = guiGridListGetItemData ( vehList, row, 1 )
    		triggerServerEvent ( "SACGSpawners:spawnVehicle", localPlayer, id, marker, true )
    		closeWindow ( localPlayer )
    	end
    end 
    
    function closeWindow ( p )
    	if ( not p or p == localPlayer ) then
    		removeEventHandler ( 'onClientMarkerLeave', marker, closeWindow )
    		marker = nil
    		guiSetVisible ( window, false )
    		showCursor ( false )
    		guiGridListClear ( vehList )
    		removeEventHandler ( "onClientGUIClick", btnSpawn, spawnClickingFunctions )
    		removeEventHandler ( "onClientGUIClick", btnClose, spawnClickingFunctions )
    		unbindKey ( "num_1", "down", spawnClickingFunctions )
    	end
    end
    addEvent ( "SACGSpawners:CloseWindow", true )
    addEventHandler ( "SACGSpawners:CloseWindow", root, closeWindow )

    i try like that but not working

  4. how i can make the spawner cars with key (like saur:rpg) Help me please 

     

    spawner_s.lua

    Quote

    local spawners = { 
        ['Free'] = { },
        ['Job'] = { }
    }
    local spawnedVehciles = { }
    function createFreeSpawner ( x, y, z, rz, sx, sy, sz )
        local i = #spawners['Free']+1
        local z = z - 1
        local sx, sy, sz = sx or x, sy or y, sz or z+1.5
        local rz = rz or 0
        spawners['Free'] = createMarker ( x, y, z, 'cylinder', 2, 255, 255, 255, 120 )
        setElementData ( spawners['Free'], "SpawnCoordinates", { sx, sy, sz, rz } )
        setElementData ( spawners['Free'], "SACGVehicles:SpawnVehicleList", JobVehicles['Free'] )
        setElementData ( spawners['Free'], "SACGVehicles:JobRestriction", false )
        addEventHandler ( "onMarkerHit", spawners['Free'], onSpawnerHit )
        return spawners['Free']
    end

    function createJobSpawner ( job, x, y, z, colors, rz, sx, sy, sz )
        local i = #spawners['Job']+1
        local z = z - 1
        local sx, sy, sz = sx or x, sy or y, sz or z+1.5
        local rz = rz or 0
        local r, g, b = unpack ( colors )
        spawners['Job'] = createMarker ( x, y, z, 'cylinder', 2, r, g, b, 120 )
        setElementData ( spawners['Job'], "SpawnCoordinates", { sx, sy, sz, rz } )
        setElementData ( spawners['Job'], "SACGVehicles:SpawnVehicleList", JobVehicles[job] )
        setElementData ( spawners['Job'], "SACGVehicles:JobRestriction", tostring ( job ) )
        addEventHandler ( "onMarkerHit", spawners['Job'], onSpawnerHit )
        return spawners['Job']
    end


    function onSpawnerHit ( p )
        local job = string.lower ( getElementData ( source, "SACGVehicles:JobRestriction" ) or "false" )
        if ( job == 'false' ) then job = false end
        local pJob =  string.lower ( getElementData ( p, "Job" ) or "" )
        if ( job ) then
            if ( pJob ~= job ) then
                exports['SACGMessages']:sendClientMessage ( "This spawner is for the "..job.." job. You're not in the "..job.." job.", p, 255, 140, 40 )
                return
            end
        end
        
        if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) ) then
            local list = getElementData ( source, "SACGVehicles:SpawnVehicleList" );
            triggerClientEvent ( p, 'SACGSpawners:ShowClientSpawner', p, list, source )
            triggerEvent ( "SACGSpawners:onPlayerOpenSpawner", source, p )
        end
    end


    addEvent ( "SACGSpawners:spawnVehicle", true )
    addEventHandler ( "SACGSpawners:spawnVehicle", root, function ( id, x, y, z, rz, job ) 
        local c = exports['SACGAntiRestart']:createPlayerVehicle ( source, id, x, y, z, rz, true, job )
    end )

    for i, v in pairs ( data ) do 
        if ( i == 'Free' ) then
            for k, e in ipairs ( v ) do 
                createFreeSpawner ( unpack ( e ) )
            end
        elseif ( i == 'Jobs' ) then
            for k, e in ipairs ( v ) do 
                createJobSpawner ( unpack ( e ) )
            end
        end
    end

    addEvent ( "SACGSpawners:onPlayerOpenSpawner", true )

     

     

    spawner_c.lua

    Quote

    local sx, sy  = guiGetScreenSize ( )
    local rsx, rsy = sx / 1280, sy / 1024
    local window = guiCreateWindow( ( sx / 2 - ( rsx*354 ) / 2 ), ( sy / 2 - (rsy*400) / 2 ), (rsx*354), (rsy*400), "SACG:RPG Vehicle", false)
    local vehList = guiCreateGridList((rsx*9), (rsy*26), (rsx*335), (rsy*315), false, window)
    local btnSpawn = guiCreateButton((rsx*9), (rsy*346), (rsx*149), (rsy*43), "Spawn", false, window)
    local btnClose = guiCreateButton((rsx*195), (rsy*346), (rsx*149), (rsy*43), "Cancel", false, window)
    guiWindowSetSizable(window, false)
    guiSetVisible ( window, false )
    guiGridListAddColumn(vehid, "id", 0.9)
    guiGridListAddColumn(vehList, "Vehicle", 0.9)
    local marker = nil
    addEvent ( "SACGSpawners:ShowClientSpawner", true )
    addEventHandler ( "SACGSpawners:ShowClientSpawner", root, function ( cars, mrker )
        if ( wasEventCancelled ( ) ) then    
            return
        end
        
        if ( not guiGetVisible ( window ) ) then 
            bindKey  ( "num_1", "down", spawnClickingFunctions )
            bindKey  ( "num_2", "down", spawnClickingFunctions )
            showCursor ( true )
            guiSetVisible ( window, true )
            guiGridListClear ( vehList )
            addEventHandler ( 'onClientMarkerLeave', mrker, closeWindow )
            marker = mrker
            job = getElementData ( marker, "SACGVehicles:JobRestriction" )
            guiGridListSetItemText ( vehList, guiGridListAddRow ( vehList ), 1, "Free Vehicles", true, true )
            for i, v in ipairs ( cars ) do
                local name = getVehicleNameFromModel ( v )
                local row = guiGridListAddRow ( vehList )
                guiGridListSetItemText ( vehList, row, 1, name, false, false )
                guiGridListSetItemData ( vehList, row, 1, v )
            end
            
            if ( exports.SACGVIP:isPlayerVIP ( ) ) then
                local level = exports.SACGVIP:getVipLevelFromName ( getElementData ( localPlayer, "VIP" ) )
                if ( level and level > 0 and VipVehicles [ level ] and #VipVehicles [ level ] > 0 ) then
                    guiGridListSetItemText ( vehList, guiGridListAddRow ( vehList ), 1, "VIP Vehicles", true, true )
                    for i, v in pairs ( VipVehicles [ level ] ) do
                        local name = getVehicleNameFromModel ( v )
                        local row = guiGridListAddRow ( vehList )
                        guiGridListSetItemText ( vehList, row, 1, name, false, false )
                        guiGridListSetItemData ( vehList, row, 1, v )
                    end
                end
            end
            
            guiGridListSetSelectedItem ( vehList, 0, 1 )
            addEventHandler ( "onClientGUIClick", btnSpawn, spawnClickingFunctions )
            addEventHandler ( "onClientGUIClick", btnClose, spawnClickingFunctions )
        end
    end )


    function spawnClickingFunctions ( )
        if ( source == btnClose ) then
            closeWindow ( localPlayer )
        elseif ( source == btnSpawn ) or getKeyState( "num_1" ) == true then
            local row, col = guiGridListGetSelectedItem ( vehList )
            if ( row == -1 ) then
                return exports['SACGMessages']:sendClientMessage ( "Select a vehicle to be spawn.", 255, 255, 0 )
            end
            
                    function af(button, press)
             if button == "1"  and press == true then
             triggerServerEvent("bo", resourceRoot)
             end
    end
            
            local id = guiGridListGetItemData ( vehList, row, 1 )
            triggerServerEvent ( "SACGSpawners:spawnVehicle", localPlayer, id, marker, true )
            closeWindow ( localPlayer )
        end
    end 

    function closeWindow ( p )
        if ( not p or p == localPlayer ) then
            removeEventHandler ( 'onClientMarkerLeave', marker, closeWindow )
            marker = nil
            guiSetVisible ( window, false )
            showCursor ( false )
            guiGridListClear ( vehList )
            removeEventHandler ( "onClientGUIClick", btnSpawn, spawnClickingFunctions )
            removeEventHandler ( "onClientGUIClick", btnClose, spawnClickingFunctions )
            unbindKey ( "num_1", "down", spawnClickingFunctions )
        end
    end
    addEvent ( "SACGSpawners:CloseWindow", true )
    addEventHandler ( "SACGSpawners:CloseWindow", root, closeWindow )

     

×
×
  • Create New...