Jump to content

[HELP] GUI Car


Recommended Posts

Posted
function scriptCreateTank ( localPlayer ) 
      local localPlayer = getRandomPlayer() 
      local x, y, z = getElementPosition ( localPlayer ) 
      createVehicle ( 432, x, y, z ) 
      outputChatBox ( "You've been given a tank", localPlayer ) 
end 
addEventHandler("onClientGUIClick", vipcar, scriptCreateTank, false) 

es ko client side use kar rha hu aur button b yahi naam sy hai magar kaam nahi kar rha

MTA PLAYER SINCE 2008

Staff at UGC - [uGC]Robin|GIGN

Ex Staff AND MEMBER OF WGS(RACE CLAN)

EX-OWNER AT POWER-GAMING

EX-Leading Staff at SGC

EX-FOUNDER of CIG

EX-FOUNDER of Sm [stealth]

EX-Staff of The Matrix

My Community Scripts

Private Interiors

TIME PLAYED [TAB]

Job Command

Private Pickups

Posted

Iss mein getRandomPlayer() aik server-only function hai jo ke client side par use nahi ho sakta, tum ye try karo:

Client.lua

function vipCarHandler() 
    local x, y, z = getElementPosition (localPlayer) 
    local veh = createVehicle (432, x, y, z) 
    outputChatBox ("You've been given a tank") 
end 
addEventHandler("onClientGUIClick", vipcar, vipCarHandler, false) 

Pehli baat, tum ne localPlayer ko getRandomPlayer kyun kiya? getRandomPlayer koi bhi player pick karega, na ke jis ne button press kiya.

Dusri baat, "onClientGUIClick" sirf client side ki event hai, is ko server par use nahi kiya ja sakta.

Tisri baat, localPlayer ko define karnay ki zaroorat nahi hai, localPlayer() aik predefined function hai jo ke button press karnay wala client hota hai, in GUI cases.

Posted

SORRY for posting this.

robin, aap ak topic bana sakto app ne help ke liya aur waha pein post karte jao. ite sara topic se board spam hora.

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