Jump to content

Nill


Best-Killer

Recommended Posts

Posted
        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

Posted

Maybe full script? Also try this.

  
... 
if ( getElementData(localPlayer, "VIP") ~= "Silver" ) then 
... 

Posted
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) 

  • Moderators
Posted
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.

Posted

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) 

  • Moderators
Posted
the vip names Silver/Gold/Bronze/Premuim

i won't the cars for all vip players

example :

Bronze : NRG-500

Silver : NRG-500 + Sultan

understand ?

Sure, but that doesn't mean you don't have to add debug lines.

Posted
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

  • Moderators
Posted

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 

Posted
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

Posted
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 ? :/

  • Moderators
Posted

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 ) 

Posted (edited)
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

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