[Release] TokoVOIP: a TeamSpeak based voip system

Then go to the style.css and change the alpha of the background

Alright so, I’ve been trying to work on a code to freeze players whenever displayPluginScreen(true) is being called, and I’m having a hard time. It works After I restart the script, and obviously it would be preferred to work correctly on start up.

I have it trying to work in this part of the code:

Citizen.CreateThread(function()
		local lastTSConnected = 0;
		local playerPed = GetPlayerPed(-1);

		while not isLoggedIn do
			Wait(50);
		end
		while true do
			Wait(50);
			lastTSConnected = lastTSConnected + 50;
			if (voip.pluginStatus == 3 and voip.pluginVersion == voip.latestVersion) then
				lastTSConnected = 0;
				displayPluginScreen(false);
				if voip.pluginStatus == 3 then
					if not IsEntityVisible(playerPed) then
						SetEntityVisible(playerPed, true)
					end
					if not IsPedInAnyVehicle(playerPed) then
						SetEntityCollision(playerPed, true)
					end
					SetEntityAlpha(playerPed, 255, skin)
					SetEnableHandcuffs(playerPed, false)
					SetPlayerInvincible(playerPed, false)
					if FreezeEntityPosition(playerPed) == true then
						FreezeEntityPosition(playerPed, false)
					elseif FreezeEntityPosition(playerPed) ~= false then
						FreezeEntityPosition(playerPed, false)
					end
					DisablePlayerFiring(playerPed, false)
				end
			else 
				if (lastTSConnected > 2000) then
					displayPluginScreen(true);
					if voip.pluginStatus == 2 or voip.pluginStatus == 1 then
						SetEntityAlpha(playerPed, 100, skin)
						if not IsPedFatallyInjured(playerPed) then
							ClearPedTasksImmediately(playerPed)
						end
						ClearPedSecondaryTask(playerPed)
						SetEntityCollision(playerPed, false)
						SetPlayerInvincible(playerPed, true)
						SetEnableHandcuffs(playerPed, true)
						DisablePlayerFiring(playerPed, true)
						if IsPedArmed(GetPlayerPed(-1), 7) then
							SetCurrentPedWeapon(playerPed, GetHashKey('WEAPON_UNARMED'), true)
						end
						FreezeEntityPosition(playerPed, true)
					end
				end
			end
		end
	end);

So I’m open to criticism for ideas on a fix.

edit1: grammar

@ZockerBoysHD I’ve added an option to whitelist other TS channels in the next version, I’ll try to finish the release before the weekend ends

@Autwey One thing’s for sure, you should just move that code inside displayPluginScreen itself and work with the boolean to avoid redoing things over and over in the loop. That way you won’t need conditions with pluginstatus, im not even sure why you’re checking for those. Prints and tests are your friends, trial and error.

hahaha i was testing and never updated the code. I’m just not getting any luck. the code for setting conditions to the ped only work after a restart of the script. it seems like its not able to figure out the ped target quick enough.

If you want to freeze the player when not connected

I GOT IT WORKING!

Citizen.CreateThread(function()
		local lastTSConnected = 0;
		local playerPed = GetPlayerPed(-1);

		while not isLoggedIn do
			Wait(50);
		end
		while true do
			Wait(50);
			lastTSConnected = lastTSConnected + 50;
			if (voip.pluginStatus == 3 and voip.pluginVersion == voip.latestVersion) then
				lastTSConnected = 0;
				displayPluginScreen(false)
				if lastTSConnected == 0 then
					playerPed = GetPlayerPed(-1); 
					if not IsEntityVisible(playerPed) then
						SetEntityVisible(playerPed, true)
					end
					if not IsPedInAnyVehicle(playerPed) then
						SetEntityCollision(playerPed, true)
					end
					SetEntityAlpha(playerPed, 255, skin)
					SetEnableHandcuffs(playerPed, false)
					SetPlayerInvincible(playerPed, false)
					if FreezeEntityPosition(playerPed) == true then
						FreezeEntityPosition(playerPed, false)
					elseif FreezeEntityPosition(playerPed) ~= false then
						FreezeEntityPosition(playerPed, false)
					end
					DisablePlayerFiring(playerPed, false)
					--print("No Screen")
				end
			else 
				if (lastTSConnected > 2000) then
					displayPluginScreen(true)
					if (lastTSConnected >> 2000) then 
						playerPed = GetPlayerPed(-1);
						SetEntityAlpha(playerPed, 100, skin)
						if not IsPedFatallyInjured(playerPed) then
							ClearPedTasksImmediately(playerPed)
						end
						ClearPedSecondaryTask(playerPed)
						SetEntityCollision(playerPed, false)
						SetPlayerInvincible(playerPed, true)
						SetEnableHandcuffs(playerPed, true)
						DisablePlayerFiring(playerPed, true)
						if IsPedArmed(GetPlayerPed(-1), 7) then
							SetCurrentPedWeapon(playerPed, GetHashKey('WEAPON_UNARMED'), true)
						end
						FreezeEntityPosition(playerPed, true)
						--print("Screen")
					end
				end
			end
		end
	end);
1 Like

hi guys how to can remove blackscreen when join the game ? i want normal player can join the game without blackscreen and only medic and police use radio (team speak )

I have my setup that way, you would need to disable the on resourceStart,

--[[
function resourceStart(resource)
	if (resource == GetCurrentResourceName()) then	--	Initialize the script when this resource is started
		Citizen.CreateThread(function()
			Wait(3000);
			if (not isRunning) then
				isRunning = true;
				initializeVoip();
			end
		end);
	end
end
--AddEventHandler("onClientResourceStart", resourceStart);
]]--

-- add this code below
function resourceStartVOIP(source)
	Citizen.CreateThread(function()
		Wait(3000);
		if (not isRunning) then
			isRunning = true;
			initializeVoip();
		end
	end);
end

and in the resource.lua add

export "resourceStartVOIP"

then add this to in service for police and ems

exports.tokovoip_script:resourceStartVOIP()

That will activate ■■■■■■■■ without be on all the time

thx dude i try this

Awesome, let me know how it goes

If i use the SR_TokoRadioswitch script with ■■■■■■■■ and change my radio channel and then leave it and try to talk it doesn’t work. Teamspeak is somehow set to not detect my voice. how can i fix that?

A new update will be coming soon, right now I need to do some more proper testing on it.
You can follow the progress on this pull request: PR #15

1 Like

don’t use Voice activated. we know that causes a problem.

I hope it is ok if i give this out. Since i get 10 messages i do not wana answer anymore i will give this version of GCPhone out to use with TojoVOIP. Hope it is ok for you guys.

Sorry for my english.

3 Likes

This is great other than one minor flaw. directional audio seems to mean defaulting to left channel or right channel which is like the uncanny valley of hearing. is there no way to make the left or right channel quieter rather than muting it completely?

it doesnt mute ears for me… not sure what you’re experiencing. If you’re using 1.2.2 its directional by the players position, not camera. The next update he’s in the progress of coding, will give you the option of characters heading or camera heading.

edit: I’m currently using the camera positioning code and it works great.

Hey, TokoVoip is crashing Teamspeak 3 after the latest windows 10 64bit update.
you can’t even launch the software if the plugin installed.

I can’t confirm, I’ve update windows to latest and still haven’t crashed TeamSpeak 3, nor has anyone on my server. Can provide a dump log/error log from TeamSpeak or Windows, it will to figure out your issue

that’s weird, I will try to reinstall the plugin one more time and see.

@vonbismarck45 I am still getting the crash see video

the latest windows 10 64bit update I had was today a few hours ago, since the update teamspeak has been crashing with the plugin installed.

Numerous re-installs, restarts and file relocations have proved unsuccessful. TS3 installs and opens just fine, upon installation of TokoVoIP 1_2_2, TS3 crashes immediately upon launch. Once any trace of Toko is removed, TS3 opens fine once again.

Crashes were present in these situations:

Teamspeak3 3.3.0 both 32 bit and 64 bit using Toko 1_2_2
Teamspeak3 3.2.5 both 32 bit and 64 bit using Toko 1_2_1_3