Jump to content

Looking 4


S3M

Recommended Posts

You want random spawns?

If so, then:

local tSpawns = 
{ 
    { -1234, -349, 29 }; 
    { -2945, -296, 10 }; 
} 
     
addEventHandler ( 'onPlayerJoin', root, 
    function ( ) 
        local uRandom = tSpawns [ math.random ( #tSpawns ) ] 
        local nX, nY, nZ = uRandom[1], uRandom[2], uRandom[3] 
        spawnPlayer ( source, nX, nY, nZ ); 
    end 
) 

Edited by Guest
Link to comment
  
function spawnDaNoobs(source,_) 
    local name = getPlayerName(source) --Get nickname 
    if (name = MyFuckingNiceUsername) then 
        setElementPosition(source, 0, 0, 100) --Spawning xyz, here as a suicide spawn above Blueberry. 
        setElementModel(source, 286) --Setting skin, to the FBI skin. 
    elseif (name = MyFriend) then 
        setElementPosition(source, 0, 0, 5) --Spawning xyz, here at the Blueberry farm. 
        setElementModel(source, 0) --Setting skin, to the CJ skin. 
    else 
        setElementPosition(source, x, y, z) --Edit it. 
        setElementModel(source, skin) --Edit it. 
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), spawnDaNoobs) 
  

Not sure, untested.

Link to comment
  
function spawnDaNoobs(source,_) 
    local name = getPlayerName(source) --Get nickname 
    if (name = ) then 
        setElementPosition(source, 0, 0, 100) --Spawning xyz, here as a suicide spawn above Blueberry. 
        setElementModel(source, 286) --Setting skin, to the FBI skin. 
    elseif (name = MyFriend) then 
        setElementPosition(source, 0, 0, 5) --Spawning xyz, here at the Blueberry farm. 
        setElementModel(source, 0) --Setting skin, to the CJ skin. 
    else 
        setElementPosition(source, x, y, z) --Edit it. 
        setElementModel(source, skin) --Edit it. 
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), spawnDaNoobs) 
  

Not sure, untested.

wrong at so many levels

Link to comment
  
function spawnDaNoobs(source,_) 
    local name = getPlayerName(source) --Get nickname 
    if (name = ) then 
        setElementPosition(source, 0, 0, 100) --Spawning xyz, here as a suicide spawn above Blueberry. 
        setElementModel(source, 286) --Setting skin, to the FBI skin. 
    elseif (name = MyFriend) then 
        setElementPosition(source, 0, 0, 5) --Spawning xyz, here at the Blueberry farm. 
        setElementModel(source, 0) --Setting skin, to the CJ skin. 
    else 
        setElementPosition(source, x, y, z) --Edit it. 
        setElementModel(source, skin) --Edit it. 
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), spawnDaNoobs) 
  

Not sure, untested.

wrong at so many levels

Well, I'm a new scripter :D

Also, second time I use event handler, and the first script is not donw, and is currently not working. (Prices for winning in race gamemode).

Link to comment

'=' you give the name of the argument

'==' compare (As in mathematics)

  
local me = getLocalPlayer() 
local name = getPlayerName(source) 
if (me == name) then 
outputChatBox ('work') 
end 
  

'~=' approximately equal, ie, the system will not be equated

as example

2+2.1 = 4.1

so if (2+2.1) == 4 its will wrong

else (2+2.1) ~= 4 will working

Link to comment

Searching for the solution, try and try again, but I get this spawn points idea is not good.

For 4 years ago was to make a script easier.

Is there something changed in mta: sa causing some command no longer function? or am I so stupid and forgetful.

Meanwhile I have found this script, it's almost the same idea that I want, I just want some player their own position / spawn point without a vehicle.

 vehicle1 = createVehicle ( 506, 2506.3994140625, -1651.6337890625, 13.603052139282   ) --here you can change car model and car's coordinates (where it's gonna be) 
--addVehicleUpgrade ( vehicle1, 1010 ) -- if you want to add an upgrade to certain vehicle 
setVehicleColor ( vehicle1, 0, 0, 0, 0 ) -- for changing vehicle colour, first '0' is for main vehicle colour 
setElementData(vehicle1, "owner", "S3M") --"account" replace with player's account name 
  
function onLockedVehicleEnter ( player, seat, jacked ) 
    if getElementData(source, "owner") and getElementData(source, "owner" ) ~= getAccountName(getPlayerAccount(player)) and ( seat == 0 ) then 
        outputChatBox ("* VEHICLE * You may not use this vehicle as it belongs to: "..tostring(getElementData(source, "owner" )), player, 255, 0, 0) 
        cancelEvent() 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), onLockedVehicleEnter ) 

How do i change this to only with player spawnpoint on name, onjoin, and onplayerdie.

Link to comment
-- Create a table with names and coordinates. 
local spawnPoints = 
    { 
        [ "Solidsnake14" ] = { 0, 0, 5 }, 
        [ "Castillo" ] = { 0, 0, 10 }, 
        [ "S3M" ] = { 0, 0, 15 } 
    } 
     
function spawn ( thePlayer ) 
    local playerName = getPlayerName ( thePlayer ):gsub ( "#%x%x%x%x%x%x", "" ) -- Get the player name and remove his HEX colors.  
    if ( spawnPoints [ playerName ] ) then -- If the player has a spawn point .. 
        spawnPlayer ( thePlayer, unpack ( spawnPoints [ playerName ] ) ) -- Unpack the coordinates of his spawn point and spawn him. 
    end 
end 
  
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        spawn ( source ) 
    end 
) 
  
addEventHandler ( "onPlayerWasted", root, 
    function ( ) 
        spawn ( source ) 
    end 
) 

Link to comment
-- Create a table with names and coordinates. 
local spawnPoints = 
    { 
        [ "Solidsnake14" ] = { 0, 0, 5 }, 
        [ "Castillo" ] = { 0, 0, 10 }, 
        [ "S3M" ] = { 0, 0, 15 } 
    } 
     
function spawn ( thePlayer ) 
    local playerName = getPlayerName ( thePlayer ):gsub ( "#%x%x%x%x%x%x", "" ) -- Get the player name and remove his HEX colors.  
    if ( spawnPoints [ playerName ] ) then -- If the player has a spawn point .. 
        spawnPlayer ( thePlayer, unpack ( spawnPoints [ playerName ] ) ) -- Unpack the coordinates of his spawn point and spawn him. 
    end 
end 
  
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        spawn ( source ) 
    end 
) 
  
addEventHandler ( "onPlayerWasted", root, 
    function ( ) 
        spawn ( source ) 
    end 
) 

THX Solidsnake14 this works :D... only now a problem with the spawnpoint that i have in resource cdm or play.

Maybe i must only use this, but then i mis the player spawnpoint who not this table you made.

you ( Solidsnake14) know a solution for this?

Link to comment
You can get a random spawn point if he's not in the table.

but its spawn the player who's in table too.

if i use resource cdm/play then first it use the table, after team choice/enter to join, the player in table goes to the spawnpoint too, to the spawnpoint what is set in the cdm/play resource.

i hope you understand my explanation.

maybe you must try this code/script on play/cdm mode

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