Jump to content

Skins Bug


Tando

Recommended Posts

local skins = { 
        { 10, "TEST","TEST2"},
}


local SkinLocs = { 
        [1] = {
                outPos = { 1459.16, -1140.48, 24.06 },
                inPos = { 161.1, -83.64, 1001.8 },
                int = 18,
                dim = 18
        },
        
      

        

        
}





local markers = { }
local sx, sy = guiGetScreenSize ( )
local org = { }

function onClientMarkerSkinHit2 ( p )
        if ( p ~= localPlayer or getElementDimension(localPlayer)~=getElementDimension(source) or getElementInterior(source)~=getElementInterior(localPlayer) ) then return end
        org.skin = getElementModel ( p )
        
        window = guiCreateWindow(10, (sy/2-403/2), 222, 403, "Group Skin Shop", false)
        guiWindowSetSizable(window, false)
        tmp2 = guiCreateLabel(14, 34, 98, 30, "Choose skin", false, window)
        list = guiCreateGridList(13, 64, 197, 278, false, window)
        guiGridListAddColumn(list, "", 0.9)
      ---Removedtmp1 = guiCreateLabel(112, 34, 98, 30, "Skins Group \nAre $1,200", false, window)
        cancel = guiCreateButton(13, 352, 85, 32, "Cancel", false, window)
        buy = guiCreateButton(102, 352, 85, 32, "Buy Skin", false, window)
        showCursor ( true )
        for i, v in pairs ( skins ) do
                local r = guiGridListAddRow ( list )
                guiGridListSetItemText ( list, r, 1, tostring ( v [ 2 ] ).." (Clan: "..tostring ( v [ 3 ] )..")", false, false )
                                guiGridListSetItemData ( list, r, 1,  tostring ( v [ 3 ] )) 
        end
        
        addEventHandler ( "onClientGUIClick", root, onClientGUIClick_Skin2 )
end

function onClientGUIClick_Skin2 ( )

        if ( source == cancel ) then
                closeSkinShop2 ( true )
        elseif ( source == buy ) then
                local r, c = guiGridListGetSelectedItem ( list )
                if ( row == -1 ) then return exports.Messages:sendClientMessage("SAUG Shop : No skin selected",255,0,0) end
                local t = guiGridListGetItemText ( list,  r, 1 )
                local SGroup = guiGridListGetItemData(list, r, 1)
				outputDebugString(SGroup)
                for i, v in pairs ( skins ) do
                        if ( tostring ( v [ 2 ].." (Clan: "..tostring ( v [ 3 ] )..")" ):lower ( ) == tostring ( t ):lower ( ) ) then
                                sI = v [ 1 ]
                                break
                        end
                end
                
                if getElementData (localPlayer,"Job") == "Police" then 
				return exports.Messages:sendClientMessage ( "SAUG Shop : You can't Equip any skin as Police, you must have job for this action.", 255, 0, 0 )
                end
				
                if  getElementData (localPlayer,"Clan") ~= SGroup then
                        return exports.Messages:sendClientMessage ( "SAUG Shop : You are not part of this group", 255, 0, 0 )
                end
                if getElementData(localPlayer,"Clan") == SGroup then
                triggerServerEvent ( "SAUGShops:Skin:UpdatePlayerDefaultSkin1", localPlayer, sI, SGroup )
        end
end
end

function closeSkinShop2 ( rSkin )
        removeEventHandler ( "onClientGUIClick", root, onClientGUIClick_Skin2 )
        destroyElement ( tmp2 )
      --  destroyElement ( tmp1 )
        destroyElement ( list )
        destroyElement ( buy )
        destroyElement ( cancel )
        destroyElement ( window )
        showCursor ( false )
       
end


for i, s in pairs ( SkinLocs ) do
        local x, y, z = unpack ( s.inPos )
        local sx, sy, sz = unpack ( s.outPos )
        markers[i] = createMarker ( x, y, z - 1, "cylinder", 1.5, 50, 255, 50, 200 )
        local blip = createBlip( sx, sy, sz, 45)
        setElementInterior ( markers[i], s.int )
        setElementDimension ( markers[i], s.dim )
        setBlipVisibleDistance(blip, 1000)
        local d = {
                int = s.int,
                dim = s.dim
        }
        setElementData ( markers[i], "SAUGShops:Skins->MarkerInfo1", d )
        addEventHandler ( "onClientMarkerHit", markers[i], onClientMarkerSkinHit2 )
end



---

server.lua

addEvent ( "SAUGShops:Skin:UpdatePlayerDefaultSkin1", true )

addEventHandler ( "SAUGShops:Skin:UpdatePlayerDefaultSkin1", root, function ( s,Clan )

    if (getElementData(client) >= tonumber(Clan)) and allowed[getElementData(client, "Clan")] then

		getElementData( client, (Clan) )
		exports.SAUGucp:givePlayerAch(client,20)
        exports.SAUGMessages:sendClientMessage ( "You have purchased a new skin!", client, 0, 255, 0 )

        setElementData ( client, "SAUGUser.UnemployedSkin", s )

        local t = getPlayerTeam ( client )

        setElementModel ( client, s )

        else

        exports.SAUGMessages:sendClientMessage ( "You cannot Buy/Change your skin", client, 255, 0, 0 )

 end

end )

bug on 

    if (getElementData(client) >= tonumber(Clan)) and allowed[getElementData(client, "Clan")] then

        getElementData( client, (Clan) )

 

i have changed it from price to clan !!

{ 10, "TEST","TEST2"},

10= skin , TEST = Skin name , TEST2 = Clan name

Link to comment
5 hours ago, (SAUG)Tando said:

local skins = { 
        { 10, "TEST","TEST2"},
}


local SkinLocs = { 
        [1] = {
                outPos = { 1459.16, -1140.48, 24.06 },
                inPos = { 161.1, -83.64, 1001.8 },
                int = 18,
                dim = 18
        },
        
      

        

        
}





local markers = { }
local sx, sy = guiGetScreenSize ( )
local org = { }

function onClientMarkerSkinHit2 ( p )
        if ( p ~= localPlayer or getElementDimension(localPlayer)~=getElementDimension(source) or getElementInterior(source)~=getElementInterior(localPlayer) ) then return end
        org.skin = getElementModel ( p )
        
        window = guiCreateWindow(10, (sy/2-403/2), 222, 403, "Group Skin Shop", false)
        guiWindowSetSizable(window, false)
        tmp2 = guiCreateLabel(14, 34, 98, 30, "Choose skin", false, window)
        list = guiCreateGridList(13, 64, 197, 278, false, window)
        guiGridListAddColumn(list, "", 0.9)
      ---Removedtmp1 = guiCreateLabel(112, 34, 98, 30, "Skins Group \nAre $1,200", false, window)
        cancel = guiCreateButton(13, 352, 85, 32, "Cancel", false, window)
        buy = guiCreateButton(102, 352, 85, 32, "Buy Skin", false, window)
        showCursor ( true )
        for i, v in pairs ( skins ) do
                local r = guiGridListAddRow ( list )
                guiGridListSetItemText ( list, r, 1, tostring ( v [ 2 ] ).." (Clan: "..tostring ( v [ 3 ] )..")", false, false )
                                guiGridListSetItemData ( list, r, 1,  tostring ( v [ 3 ] )) 
        end
        
        addEventHandler ( "onClientGUIClick", root, onClientGUIClick_Skin2 )
end

function onClientGUIClick_Skin2 ( )

        if ( source == cancel ) then
                closeSkinShop2 ( true )
        elseif ( source == buy ) then
                local r, c = guiGridListGetSelectedItem ( list )
                if ( row == -1 ) then return exports.Messages:sendClientMessage("SAUG Shop : No skin selected",255,0,0) end
                local t = guiGridListGetItemText ( list,  r, 1 )
                local SGroup = guiGridListGetItemData(list, r, 1)
				outputDebugString(SGroup)
                for i, v in pairs ( skins ) do
                        if ( tostring ( v [ 2 ].." (Clan: "..tostring ( v [ 3 ] )..")" ):lower ( ) == tostring ( t ):lower ( ) ) then
                                sI = v [ 1 ]
                                break
                        end
                end
                
                if getElementData (localPlayer,"Job") == "Police" then 
				return exports.Messages:sendClientMessage ( "SAUG Shop : You can't Equip any skin as Police, you must have job for this action.", 255, 0, 0 )
                end
				
                if  getElementData (localPlayer,"Clan") ~= SGroup then
                        return exports.Messages:sendClientMessage ( "SAUG Shop : You are not part of this group", 255, 0, 0 )
                end
                if getElementData(localPlayer,"Clan") == SGroup then
                triggerServerEvent ( "SAUGShops:Skin:UpdatePlayerDefaultSkin1", localPlayer, sI, SGroup )
        end
end
end

function closeSkinShop2 ( rSkin )
        removeEventHandler ( "onClientGUIClick", root, onClientGUIClick_Skin2 )
        destroyElement ( tmp2 )
      --  destroyElement ( tmp1 )
        destroyElement ( list )
        destroyElement ( buy )
        destroyElement ( cancel )
        destroyElement ( window )
        showCursor ( false )
       
end


for i, s in pairs ( SkinLocs ) do
        local x, y, z = unpack ( s.inPos )
        local sx, sy, sz = unpack ( s.outPos )
        markers[i] = createMarker ( x, y, z - 1, "cylinder", 1.5, 50, 255, 50, 200 )
        local blip = createBlip( sx, sy, sz, 45)
        setElementInterior ( markers[i], s.int )
        setElementDimension ( markers[i], s.dim )
        setBlipVisibleDistance(blip, 1000)
        local d = {
                int = s.int,
                dim = s.dim
        }
        setElementData ( markers[i], "SAUGShops:Skins->MarkerInfo1", d )
        addEventHandler ( "onClientMarkerHit", markers[i], onClientMarkerSkinHit2 )
end



---

server.lua


addEvent ( "SAUGShops:Skin:UpdatePlayerDefaultSkin1", true )

addEventHandler ( "SAUGShops:Skin:UpdatePlayerDefaultSkin1", root, function ( s,Clan )

    if (getElementData(client) >= tonumber(Clan)) and allowed[getElementData(client, "Clan")] then

		getElementData( client, (Clan) )
		exports.SAUGucp:givePlayerAch(client,20)
        exports.SAUGMessages:sendClientMessage ( "You have purchased a new skin!", client, 0, 255, 0 )

        setElementData ( client, "SAUGUser.UnemployedSkin", s )

        local t = getPlayerTeam ( client )

        setElementModel ( client, s )

        else

        exports.SAUGMessages:sendClientMessage ( "You cannot Buy/Change your skin", client, 255, 0, 0 )

 end

end )

bug on 

    if (getElementData(client) >= tonumber(Clan)) and allowed[getElementData(client, "Clan")] then

        getElementData( client, (Clan) )

 

i have changed it from price to clan !!

{ 10, "TEST","TEST2"},

10= skin , TEST = Skin name , TEST2 = Clan name

try this

if (getElementData(client,"Clan") >= tonumber(Clan)) and allowed[getElementData(client, "Clan")] then

1 minute ago, AncienT said:

What is value Clan  = ?

 

Edited by AncienT
Link to comment
31 minutes ago, AncienT said:

try this

if (getElementData(client,"Clan") >= tonumber(Clan)) and allowed[getElementData(client, "Clan")] then

 

ERROR : attemmpt to compare nil with string

37 minutes ago, AncienT said:

What is value Clan  = ?

Group

players who have Group can take the skins from this shop only

Link to comment
4 minutes ago, Simple. said:

    if getElementData(client, "Clan") and allowed[getElementData(client, "Clan")] then

 

thanks it's has been fixed

addCommandHandler("muteall", function(thePlayer, _, ...)
    if(isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Staff"))) then
    ----what i have to put
    outputChatBox ("Staff Team has been mute all")
    end
end)

sry for don't make much topics

how to make when i type muteall all players get mute exept who in user.Staff

and i need command able for who inside Staff Acl Group

2 minutes ago, (SAUG)Tando said:

thanks it's has been fixed


addCommandHandler("muteall", function(thePlayer, _, ...)
    if(isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Staff"))) then
    ----what i have to put
    outputChatBox ("Staff Team has been mute all")
    end
end)

sry for don't make much topics

how to make when i type muteall all players get mute exept who in user.Staff

and i need command able for who inside Staff Acl Group

@Simple.

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