Jump to content

Nill


Best-Killer

Recommended Posts

        function spawnveh(button, press, p) 
            if(press) then 
                if(button == "1") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 468, x, y, z, localPlayer) 
                end 
                if(button == "2") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 457, x, y, z, localPlayer) 
                end 
                if(button == "3") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 412, x, y, z, localPlayer) 
                end 
                if(button == "4") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 522, x, y, z, localPlayer) 
                end 
                if(button == "5") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 560, x, y, z, localPlayer) 
                end 
                if(button == "6") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 411, x, y, z, localPlayer) 
                end 
                if(button == "7") then 
                 if ( getElementData(p, "VIP") ~= "Silver" ) then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 546, x, y, z, localPlayer) 
            end 

line 28

argument 1 got nill

Link to comment
jWin = guiCreateWindow(550,560,200,200,"Vehicle System",false) 
guiSetVisible(jWin,false) 
function openGui() 
guiSetVisible(jWin,true) 
        function spawnveh(button, press, p) 
            if(press) then 
                if(button == "1") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 468, x, y, z, localPlayer) 
                end 
                if(button == "2") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 457, x, y, z, localPlayer) 
                end 
                if(button == "3") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 412, x, y, z, localPlayer) 
                end 
                if(button == "4") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 522, x, y, z, localPlayer) 
                end 
                if(button == "5") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 560, x, y, z, localPlayer) 
                end 
                if(button == "6") then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 411, x, y, z, localPlayer) 
                end 
                if(button == "7") then 
                 if ( getElementData(p, "VIP") ~= "Silver" ) then 
                    x, y, z = getElementPosition(localPlayer) 
                    triggerServerEvent("crVeh", getRootElement(), 546, x, y, z, localPlayer) 
            end 
       end 
     end 
     end 
     end 
  
    addEventHandler("onClientKey", getRootElement(), spawnveh) 
    guiWindowSetSizable(jWin,false) 
    tGrid = guiCreateGridList(0,20,190,170,false,jWin) 
    guiGridListAddColumn(tGrid, "Key", 0.20) 
    guiGridListAddColumn(tGrid, "Name", 0.65) 
    row1 = guiGridListAddRow(tGrid) 
    row2 = guiGridListAddRow(tGrid) 
    row3 = guiGridListAddRow(tGrid) 
    row4 = guiGridListAddRow(tGrid) 
    row5 = guiGridListAddRow(tGrid) 
    row6 = guiGridListAddRow(tGrid) 
    row7 = guiGridListAddRow(tGrid) 
    guiGridListSetItemText(tGrid, row1, 1, tostring(row1+1), false, false) 
    guiGridListSetItemText(tGrid, row1, 2, "Sanchez", false, false) 
    guiGridListSetItemText(tGrid, row2, 1, tostring(row2+1), false, false) 
    guiGridListSetItemText(tGrid, row2, 2, "Caddy", false, false) 
    guiGridListSetItemText(tGrid, row3, 1, tostring(row3+1), false, false) 
    guiGridListSetItemText(tGrid, row3, 2, "Voodoo", false, false) 
    guiGridListSetItemText(tGrid, row4, 1, tostring(row4+1), false, false) 
    guiGridListSetItemText(tGrid, row4, 2, "NRG-500", false, false) 
    guiGridListSetItemText(tGrid, row5, 1, tostring(row5+1), false, false) 
    guiGridListSetItemText(tGrid, row5, 2, "Sultan", false, false) 
    guiGridListSetItemText(tGrid, row6, 1, tostring(row6+1), false, false) 
    guiGridListSetItemText(tGrid, row6, 2, "Infernus", false, false) 
    guiGridListSetItemText(tGrid, row7, 1, tostring(row7+1), false, false) 
    guiGridListSetItemText(tGrid, row7, 2, "Intruder", false, false) 
     
end 
addEvent("markerHitted", true) 
addEventHandler("markerHitted", getRootElement(), openGui) 
  
function hideGui() 
    guiSetVisible(jWin,false) 
    removeEventHandler("onClientKey", getRootElement(), spawnveh) 
end 
  
addEvent("markerLeaved", true) 
addEventHandler("markerLeaved", getRootElement(), hideGui) 

Link to comment
  • Moderators
maybe this
if getElementData(localPlayer, "VIP") or getElementData(localPlayer, "Silver") then 

Not Work

Don't waste our time with those useless replies. Debug your code better.

 outputDebugString(tostring(getElementData(localPlayer, "VIP"))) 

If it outputs nil, you simply didn't set it. Which means the bug is at the place where you should have set the element data.

Link to comment

Run this script and tell us what it outputs in the chatbox.

jWin = guiCreateWindow(550,560,200,200,"Vehicle System",false) 
guiSetVisible(jWin,false) 
function openGui() 
    guiSetVisible(jWin,true) 
    function spawnveh(button, press, p) 
        if(press) then 
            if(button == "1") then 
                 x, y, z = getElementPosition(localPlayer) 
                 triggerServerEvent("crVeh", getRootElement(), 468, x, y, z, localPlayer) 
            end 
            if(button == "2") then 
                x, y, z = getElementPosition(localPlayer) 
                triggerServerEvent("crVeh", getRootElement(), 457, x, y, z, localPlayer) 
            end 
            if(button == "3") then 
                x, y, z = getElementPosition(localPlayer) 
                triggerServerEvent("crVeh", getRootElement(), 412, x, y, z, localPlayer) 
            end 
            if(button == "4") then 
                x, y, z = getElementPosition(localPlayer) 
                triggerServerEvent("crVeh", getRootElement(), 522, x, y, z, localPlayer) 
            end 
            if(button == "5") then 
                x, y, z = getElementPosition(localPlayer) 
                triggerServerEvent("crVeh", getRootElement(), 560, x, y, z, localPlayer) 
            end 
            if(button == "6") then 
                x, y, z = getElementPosition(localPlayer) 
                triggerServerEvent("crVeh", getRootElement(), 411, x, y, z, localPlayer) 
            end 
            if(button == "7") then 
                outputChatBox("Player rank is: "tostring(getElementData(localPlayer, "VIP"))) 
                end 
            end 
        end 
     end 
end 
  
    addEventHandler("onClientKey", getRootElement(), spawnveh) 
    guiWindowSetSizable(jWin,false) 
    tGrid = guiCreateGridList(0,20,190,170,false,jWin) 
    guiGridListAddColumn(tGrid, "Key", 0.20) 
    guiGridListAddColumn(tGrid, "Name", 0.65) 
    row1 = guiGridListAddRow(tGrid) 
    row2 = guiGridListAddRow(tGrid) 
    row3 = guiGridListAddRow(tGrid) 
    row4 = guiGridListAddRow(tGrid) 
    row5 = guiGridListAddRow(tGrid) 
    row6 = guiGridListAddRow(tGrid) 
    row7 = guiGridListAddRow(tGrid) 
    guiGridListSetItemText(tGrid, row1, 1, tostring(row1+1), false, false) 
    guiGridListSetItemText(tGrid, row1, 2, "Sanchez", false, false) 
    guiGridListSetItemText(tGrid, row2, 1, tostring(row2+1), false, false) 
    guiGridListSetItemText(tGrid, row2, 2, "Caddy", false, false) 
    guiGridListSetItemText(tGrid, row3, 1, tostring(row3+1), false, false) 
    guiGridListSetItemText(tGrid, row3, 2, "Voodoo", false, false) 
    guiGridListSetItemText(tGrid, row4, 1, tostring(row4+1), false, false) 
    guiGridListSetItemText(tGrid, row4, 2, "NRG-500", false, false) 
    guiGridListSetItemText(tGrid, row5, 1, tostring(row5+1), false, false) 
    guiGridListSetItemText(tGrid, row5, 2, "Sultan", false, false) 
    guiGridListSetItemText(tGrid, row6, 1, tostring(row6+1), false, false) 
    guiGridListSetItemText(tGrid, row6, 2, "Infernus", false, false) 
    guiGridListSetItemText(tGrid, row7, 1, tostring(row7+1), false, false) 
    guiGridListSetItemText(tGrid, row7, 2, "Intruder", false, false) 
    
end 
addEvent("markerHitted", true) 
addEventHandler("markerHitted", getRootElement(), openGui) 
  
function hideGui() 
    guiSetVisible(jWin,false) 
    removeEventHandler("onClientKey", getRootElement(), spawnveh) 
end 
  
addEvent("markerLeaved", true) 
addEventHandler("markerLeaved", getRootElement(), hideGui) 

Link to comment
Run this script and tell us what it outputs in the chatbox.
jWin = guiCreateWindow(550,560,200,200,"Vehicle System",false) 
guiSetVisible(jWin,false) 
function openGui() 
    guiSetVisible(jWin,true) 
    function spawnveh(button, press, p) 
        if(press) then 
            if(button == "1") then 
                 x, y, z = getElementPosition(localPlayer) 
                 triggerServerEvent("crVeh", getRootElement(), 468, x, y, z, localPlayer) 
            end 
            if(button == "2") then 
                x, y, z = getElementPosition(localPlayer) 
                triggerServerEvent("crVeh", getRootElement(), 457, x, y, z, localPlayer) 
            end 
            if(button == "3") then 
                x, y, z = getElementPosition(localPlayer) 
                triggerServerEvent("crVeh", getRootElement(), 412, x, y, z, localPlayer) 
            end 
            if(button == "4") then 
                x, y, z = getElementPosition(localPlayer) 
                triggerServerEvent("crVeh", getRootElement(), 522, x, y, z, localPlayer) 
            end 
            if(button == "5") then 
                x, y, z = getElementPosition(localPlayer) 
                triggerServerEvent("crVeh", getRootElement(), 560, x, y, z, localPlayer) 
            end 
            if(button == "6") then 
                x, y, z = getElementPosition(localPlayer) 
                triggerServerEvent("crVeh", getRootElement(), 411, x, y, z, localPlayer) 
            end 
            if(button == "7") then 
                outputChatBox("Player rank is: "tostring(getElementData(localPlayer, "VIP"))) 
                end 
            end 
        end 
     end 
end 
  
    addEventHandler("onClientKey", getRootElement(), spawnveh) 
    guiWindowSetSizable(jWin,false) 
    tGrid = guiCreateGridList(0,20,190,170,false,jWin) 
    guiGridListAddColumn(tGrid, "Key", 0.20) 
    guiGridListAddColumn(tGrid, "Name", 0.65) 
    row1 = guiGridListAddRow(tGrid) 
    row2 = guiGridListAddRow(tGrid) 
    row3 = guiGridListAddRow(tGrid) 
    row4 = guiGridListAddRow(tGrid) 
    row5 = guiGridListAddRow(tGrid) 
    row6 = guiGridListAddRow(tGrid) 
    row7 = guiGridListAddRow(tGrid) 
    guiGridListSetItemText(tGrid, row1, 1, tostring(row1+1), false, false) 
    guiGridListSetItemText(tGrid, row1, 2, "Sanchez", false, false) 
    guiGridListSetItemText(tGrid, row2, 1, tostring(row2+1), false, false) 
    guiGridListSetItemText(tGrid, row2, 2, "Caddy", false, false) 
    guiGridListSetItemText(tGrid, row3, 1, tostring(row3+1), false, false) 
    guiGridListSetItemText(tGrid, row3, 2, "Voodoo", false, false) 
    guiGridListSetItemText(tGrid, row4, 1, tostring(row4+1), false, false) 
    guiGridListSetItemText(tGrid, row4, 2, "NRG-500", false, false) 
    guiGridListSetItemText(tGrid, row5, 1, tostring(row5+1), false, false) 
    guiGridListSetItemText(tGrid, row5, 2, "Sultan", false, false) 
    guiGridListSetItemText(tGrid, row6, 1, tostring(row6+1), false, false) 
    guiGridListSetItemText(tGrid, row6, 2, "Infernus", false, false) 
    guiGridListSetItemText(tGrid, row7, 1, tostring(row7+1), false, false) 
    guiGridListSetItemText(tGrid, row7, 2, "Intruder", false, false) 
    
end 
addEvent("markerHitted", true) 
addEventHandler("markerHitted", getRootElement(), openGui) 
  
function hideGui() 
    guiSetVisible(jWin,false) 
    removeEventHandler("onClientKey", getRootElement(), spawnveh) 
end 
  
addEvent("markerLeaved", true) 
addEventHandler("markerLeaved", getRootElement(), hideGui) 

Player rank is: silver then i changed to Gold Vip then it's showed Player rank is: Gold

Link to comment
  • Moderators

Tables would be a better solution, but you seems not to use them. So...

local VIP = getElementData(localPlayer, "VIP") 
if VIP == "Bronze" then 
    if button == "1" then 
  
    elseif button == "2" then 
  
    elseif button == "3" then 
  
    end 
elseif VIP == "Silver" then 
    if button == "1" then 
  
    elseif button == "2" then 
  
    elseif button == "3" then 
  
    elseif button == "4" then 
  
    end 
elseif VIP == "Gold" then 
-- .................. 
else -- not VIP or unknown kind. 
    if button == "1" then 
  
    elseif button == "2" then 
  
    end 
end 

Link to comment
Tables would be a better solution, but you seems not to use them. So...
local VIP = getElementData(localPlayer, "VIP") 
if VIP == "Bronze" then 
    if button == "1" then 
  
    elseif button == "2" then 
  
    elseif button == "3" then 
  
    end 
elseif VIP == "Silver" then 
    if button == "1" then 
  
    elseif button == "2" then 
  
    elseif button == "3" then 
  
    elseif button == "4" then 
  
    end 
elseif VIP == "Gold" then 
-- .................. 
else -- not VIP or unknown kind. 
    if button == "1" then 
  
    elseif button == "2" then 
  
    end 
end 

Work <3 Thanks u

Link to comment
if VIP == "None" then 
    guiGridListRemoveRow ( tGrid, row4 ) 
    guiGridListRemoveRow ( tGrid, row5 ) 
    guiGridListRemoveRow ( tGrid, row6 ) 
    guiGridListRemoveRow ( tGrid, row7 ) 
    end 

    row4 = guiGridListAddRow(tGrid) 
    row5 = guiGridListAddRow(tGrid) 
    row6 = guiGridListAddRow(tGrid) 
    row7 = guiGridListAddRow(tGrid) 

row 4 , 5 not removed but 6 7 yes why ? :/

Link to comment
  • Moderators

When you remove row 6, row 7 moves down to row 6. So when you start with 7 and count down to 4, you don't have that problem.

guiGridListRemoveRow ( tGrid, row7 ) 
guiGridListRemoveRow ( tGrid, row6 ) 
guiGridListRemoveRow ( tGrid, row5 ) 
guiGridListRemoveRow ( tGrid, row4 ) 

Link to comment
When you remove row 6, row 7 moves down to row 6. So when you start with 7 and count down to 4, you don't have that problem.
guiGridListRemoveRow ( tGrid, row7 ) 
guiGridListRemoveRow ( tGrid, row6 ) 
guiGridListRemoveRow ( tGrid, row5 ) 
guiGridListRemoveRow ( tGrid, row4 ) 

IIYAMA, just asking out of curiosity.

Is the below code is equivalent to the above one?

  
for i=1, 4 do 
guiGridListRemoveRow ( tGrid, row4 ) 
end 
  

Edited by Guest
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...