[Request] RP Area Change

was thinking at a command you could change the fivem map (which would change spawns) and make an announcement in chat saying the RP area has moved to …

Example:
/rpch sandy
(It would now change the spawn point and say in chat RP AREA CHANGE : Sandy)

It would be better for spawns as a map change would move everyone to the spawn.

Would this be a possible script?

2 Likes

Should not be hard, will do it when I’m home

1 Like

Yeah. idk much lus but thought a lot of communities would love it, including mine.

1 Like

I have finished the script just need to test it when I get home, in like 2 hours.

Sweet. How does it work function wise if you don’t mind me asking…?

You do /rpsandy /rppaleto /rpls then when you spawn you are teleported to whatever you said the coords to in the config.

sweet does it need new fivem-maps like sandy?

Also I will add a whitelist system at one point when I am home.

1 Like

sound great (20 char lim)

It will be a standalone script if that is what you’re asking.

2 Likes

cool (20 char Limit)

did you end up figuring it out?

This is very easy would you prefer essentialmode or steamid based, as I have already done this.

Steam ID for admins (20 Char)

Are you wanting it to teleport you and the other players to that area or just to display in chat.

A chat msg is displayed at the time of change and when a player first joins. And for it to teleport people to the RP Area on join. (Teleport locations could be configured as cords.

This is what I’ve got so far

Client.lua

-- Change these for your admins

admins = {
    'steam:110000105959047',
    --'license:',
}

function isAllowedToChange(player)
    local allowed = false
    for i,id in ipairs(admins) do
        for x,pid in ipairs(GetPlayerIdentifiers(player)) do
            if debugprint then print('admin id: ' .. id .. '\nplayer id:' .. pid) end
            if string.lower(pid) == string.lower(id) then
                allowed = true
            end
        end
    end
    return allowed
end

RegisterCommand('rpsandy', function(source, args)
    if source ~= 0 then
        if isAllowedToChange(source) then
                TriggerClientEvent('chatMessage', source, '', {255,255,255}, "^1RP Area: ^0Is now in Sandy Shores")
            end
        else
	           TriggerClientEvent('playerSpawned1')  
		    end
	    else
            TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^1Error: ^0You do not have permission to use this command.')
        end
    end
end)

RegisterCommand('rppaleto', function(source, args)
    if source ~= 0 then
        if isAllowedToChange(source) then
                TriggerClientEvent('chatMessage', source, '', {255,255,255}, "^1RP Area: ^0Is now in Paleto Bay")
            end
        else
	           TriggerClientEvent('playerSpawned2')  
		    end
	    else
            TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^1Error: ^0You do not have permission to use this command.')
        end
    end
end)

RegisterCommand('rpblaine', function(source, args)
    if source ~= 0 then
        if isAllowedToChange(source) then
                TriggerClientEvent('chatMessage', source, '', {255,255,255}, "^1RP Area: ^0Is now in Blaine County")
            end
        else
	           TriggerClientEvent('playerSpawned3')  
		    end
	    else
            TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^1Error: ^0You do not have permission to use this command.')
        end
    end
end)

RegisterCommand('rpsantos', function(source, args)
    if source ~= 0 then
        if isAllowedToChange(source) then
                TriggerClientEvent('chatMessage', source, '', {255,255,255}, "^1RP Area: ^0Is now in Los Santos")
            end
        else
	           TriggerClientEvent('playerSpawned4')  
		    end
	    else
            TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^1Error: ^0You do not have permission to use this command.')
        end
    end
end)
RegisterCommand('rpmap', function(source, args)
    if source ~= 0 then
        if isAllowedToChange(source) then
                TriggerClientEvent('chatMessage', source, '', {255,255,255}, "^1RP Area: ^0Is now Map Wide")
            end
        else
	           TriggerClientEvent('playerSpawned5')  
		    end
	    else
            TriggerClientEvent('chatMessage', source, '', {255,255,255}, '^1Error: ^0You do not have permission to use this command.')
        end
    end
end)

Server.lua

AddEventHandler("playerSpawned1", function(spawn)
    TriggerEvent("chatMessage", "", { 255, 255, 255 }, "^1RP Area: ^0Is now in Sandy Shores")
end)

AddEventHandler("playerSpawned2", function(spawn)
    TriggerEvent("chatMessage", "", { 255, 255, 255 }, "^1RP Area: ^0Is now in Paleto Bay")
end)

AddEventHandler("playerSpawned3", function(spawn)
    TriggerEvent("chatMessage", "", { 255, 255, 255 }, "^1RP Area: ^0Is now in Blaine County")
end)

AddEventHandler("playerSpawned4", function(spawn)
    TriggerEvent("chatMessage", "", { 255, 255, 255 }, "^1RP Area: ^0Is now in Los Santos")
end)

AddEventHandler("playerSpawned5", function(spawn)
    TriggerEvent("chatMessage", "", { 255, 255, 255 }, "^1RP Area: ^0Is now Map Wide")
end)

Just need to add coords with a function to teleport new players when (‘playerSpawned’ function(spawn)

1 Like

so in the Spawn Bracket is where the cords would go? @BabbaTundaee

runtime.fivem.net would be a good place to check! Has everything you could possibly need

it says on that site that further configuration is required