Jump to content

Help


golanu21

Recommended Posts

Posted

how i make this : When the player have "wanted level" 1 to see the star above your head?

As : "SAUR, RPG"

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

Posted
dxDrawImage 
getWorldFromScreenPosition 
getPlayerWantedLevel 

@Castro, he doesn't want to attach an object, he wants an image near player's head.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted
function starr () 
local star = createMarker ( 0, 0, 0, "arrow", 1, 255, 0, 0, 255 ) 
local level = getPlayerWantedLevel ( source ) 
if ( level > 0 ) then 
attachElements ( star, source, 0, 0, 10) 
end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), starr) 

don't work

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

Posted

There is no source element in that event, and attaching a marker to a player does not even make sense.

Check my reply above.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

There is nothing to know, it's the same as scripting with CEGUI (MTA's GUI system), except that you have to render everything in every frame with onClientRender event.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

  • 7 months later...
Posted (edited)
local Timer = {} 
  
Bribe = {} 
  
  
  
xMain_ = function(  ) 
  
        for index,v in ipairs (getElementsByType("player")) do 
  
                xWanted_(v) 
  
        end 
  
end 
  
addEventHandler("onResourceStart", resourceRoot, xMain_); 
  
  
  
xWanted_ = function(v) 
  
        if not isElement(v) then return end 
  
        Timer[v] = setTimer( 
  
        function(player) 
  
                if isElement(player) then 
  
                local team = getPlayerTeam(player) 
  
                if ( team and getTeamName(team) == "Police" ) then return end 
  
                local Wanted = getPlayerWantedLevel ( player ); 
  
                local x,y,z = getElementPosition ( player ); 
  
                local Name = getPlayerName ( player ); 
  
                        if ( Wanted >= 1 ) then 
  
                                if Bribe[player] and isElement(Bribe[player]) then return end            
  
                                Bribe[player] = createObject(1247,x,y,z); 
  
                                attachElements (Bribe[player],player,0,0,1.6) ; 
  
                                outputChatBox(" [ "..Name.." ] Have [ "..Wanted.." ] Wanted Level! ",v,255,0,0,true); 
  
                        elseif ( Wanted == 0 and Bribe[player] and isElement(Bribe[player]) ) then 
  
                                destroyElement(Bribe[player]); 
  
                                Bribe[player] = nil 
  
                        end 
  
                end 
  
        end 
  
        ,5000,0,v); 
  
end 
  
  
  
xJoin_ = function ( ) 
  
   xWanted_(source); 
  
end 
  
addEventHandler("onPlayerJoin",root,xJoin_); 
  
  
  
xWantedDestroy_ = function ( ) 
  
        if Timer[source] and isTimer(Timer[source]) then  
  
                killTimer(Timer[source]);  
  
                Timer[source] = nil 
  
        end; 
  
        if Bribe[source] and isElement(Bribe[source]) then 
  
                destroyElement(Bribe[source]); 
  
                Bribe[source] = nil 
  
        end 
  
end 
  
addEventHandler("onPlayerQuit",root,xWantedDestroy_); 

Edited by Guest

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Yes it was in my library, and I post it btw I download it from community too and I forgot about it :P

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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