Fix GTA's sexism

Hey there,

Wandering around with player’s health, I found out that if you have the female multiplayer model, you have a max health of 175 (from 100 to 75 so actually only 75 health, I don’t know why yet) and if you have a male multiplayer model you now have a max health of 200. So I made a little script to fix that :

AddEventHandler("playerSpawned", function()
	local ped = GetPlayerPed(-1)
	if GetPedMaxHealth(ped) ~= 200 and not IsEntityDead(ped) then
		SetPedMaxHealth(ped, 200)
		SetEntityHealth(ped, GetEntityHealth(ped) + 25)
	end
end)

I put it in my gamemode, and it works as expected.

Have fun !

BOOL IS_PED_MALE(Ped ped) // 6D9F5FAA7488BA46 90950455
Returns true/false if the ped is/isn't male.

What if a ped gets hurt? You probably keep resetting their health.

I’m not sure it will work 100% of the time. You have to use ped not entity max health.

SetPedMaxHealth(ped, 200)

And before you start adding 25 health, off the top of my head I’d probably check IsPedFatallyInjured, IsEntityDead, IsPedProne. Putting it in the spawnmanager.lua and setting everyone spawning to max 200 would probably be safe (use ped not entity max health of course).

And of course, it’s not really sexism. The average female can take less punches then the average male. Height, weight, muscle mass? So if you want to make it unrealistic, then of course set everyone to 200. :slight_smile:

1 Like

no, no, noooooo

There’s a playerSpawned event for a reason…

Is this in a loop? If not, how does it get triggered?

I also thought about that, but I tested a lot of damage types and it still works fine since from 0 to 100 changes nothing. After some testing the player does have 25/200 health if my code happens after the player death. I changed my post with new code to fix that.

I now check if the player is dead, because as said above, it does add 25 health to the player, even dead. Thanks !

The code I have is only the health part, I’m actually using it in a playerSpawned event as @Rubidium said.

I don’t agree with you but it’s not a debate to have on the FiveM forum :smiley: I see this as game design, it doesn’t feel right to have players with less health x)

Another note :

Changing the model on the go and not respawning will not trigger playerSpawned (obv) so you’ll have to reapply the code for it to have an effect, since changing model also changes max health. I personally have a modelChanged event that is triggered on every model change (duh).

nice any tips where in model-menu i have 2 add it ? me realy noob in this modding stuf :slight_smile:
here is the code hope someone got a clue

require "resources/essentialmode/lib/MySQL"
-- MySQL:open("IP", "databasname", "user", "password")
MySQL:open("127.0.0.1", "gta5_gamemode_essential", "root", "LUL")

RegisterServerEvent("mm:spawn")
AddEventHandler("mm:spawn", function()
	TriggerEvent("es:getPlayerFromId", source, function(target)
		local executed_query = MySQL:executeQuery("SELECT identifier FROM modelmenu WHERE identifier = '@name'", {['@name'] = target.identifier})
		local result = MySQL:getResults(executed_query, {'identifier'}, "identifier")

		if(result[1] == nil) then
			local executed_query2 = MySQL:executeQuery("INSERT INTO modelmenu(identifier) VALUES ('@name')",{['@name']= target.identifier})
			TriggerClientEvent("mm:firstspawn", source)
		else
			local mpmodel = getModelIsMP(target.identifier)
			if(mpmodel == 0) then
			local model = getmodels(target.identifier)
			TriggerClientEvent("mm:changemodelspawn", source, model)
			end
			if(mpmodel == 1) then
			local model = getmodels(target.identifier)
			TriggerClientEvent("mm:changempmodelspawn", source, model)
			end
		end
	end)
end)

RegisterServerEvent("mm:checkCustomisation")
AddEventHandler("mm:checkCustomisation", function()
	TriggerEvent("es:getPlayerFromId", source, function(target)
		local mpmodel = getModelIsMP(target.identifier)
		if(mpmodel == 0) then
			TriggerClientEvent("mm:Customisationisanonono", source)
		else
			TriggerClientEvent("mm:Customisationisagogogo", source)
		end
	end)
end)

RegisterServerEvent("mm:spawn2")
AddEventHandler("mm:spawn2", function()
	TriggerEvent("es:getPlayerFromId", source, function(target)
		local executed_query = MySQL:executeQuery("SELECT mask,mask_txt,hair,hair_colour,shoe,shoe_txt,shirt,shirt_txt,hand,pants,pants_txt,undershirt,undershirt_txt,armour,armour_txt,head,helmet,helmet_txt,glasses,glasses_txt,percing,percing_txt FROM modelmenu WHERE identifier = '@name'", {['@name'] = target.identifier})
		local result = MySQL:getResults(executed_query, {'mask', 'mask_txt', 'hair', 'hair_colour', 'shoe', 'shoe_txt', 'shirt', 'shirt_txt', 'hand', 'pants', 'pants_txt', 'undershirt', 'undershirt_txt', 'armour', 'armour_txt', 'head', 'helmet', 'helmet_txt', 'glasses', 'glasses_txt', 'percing', 'percing_txt'})
		local user = {
        hair = result[1].hair,
        hcolour = result[1].hair_colour,
        shirt = result[1].shirt,
        shirt_txt = result[1].shirt_txt,
        pants = result[1].pants,
        pants_txt = result[1].pants_txt,
        undershirt = result[1].undershirt,
        undershirt_txt = result[1].undershirt_txt,
        shoe = result[1].shoe,
        shoe_txt = result[1].shoe_txt,
        hand = result[1].hand,
        mask = result[1].mask,
        mask_txt = result[1].mask_txt,
        head = result[1].head,
        armour = result[1].armour,
        armour_txt = result[1].armour_txt,
        helmet = result[1].helmet,
        helmet_txt = result[1].helmet_txt,
        glasses = result[1].glasses,
        glasses_txt = result[1].glasses_txt,
        piercing = result[1].percing,
        piercing_txt = result[1].percing_txt
		}
		TriggerClientEvent("mm:changeeverything_spawn", source, user)
	end)
end)

RegisterServerEvent("mm:timer")
AddEventHandler("mm:timer", function()
    SetTimeout(10500, function()
    	TriggerClientEvent("mm:timerend", source)    	
    end)
end)

RegisterServerEvent("mm:timer2")
AddEventHandler("mm:timer2", function()
    SetTimeout(10500, function()
    	TriggerClientEvent("mm:timerend2", source)    	
    end)
end)

function getModelIsMP(identifier)
	local executed_query = MySQL:executeQuery("SELECT mpmodel FROM modelmenu WHERE identifier = '@name'", {['@name'] = identifier})
	local result = MySQL:getResults(executed_query, {'mpmodel'})
    local mpmodel = result[1].mpmodel
	return mpmodel
end

function getmodels(identifier)
	local executed_query = MySQL:executeQuery("SELECT model FROM modelmenu WHERE identifier = '@name'", {['@name'] = identifier})
	local result = MySQL:getResults(executed_query, {'model'})
    local model = result[1].model
	return model
end

RegisterServerEvent("mm:savempmodel")
AddEventHandler("mm:savempmodel",function(model)
	TriggerEvent('es:getPlayerFromId', source, function(target)
		local executed_query_mp = MySQL:executeQuery("UPDATE modelmenu SET mpmodel = 1 WHERE identifier='@user'",{['@user']= target.identifier})
		local executed_query = MySQL:executeQuery("UPDATE modelmenu SET model='@model' WHERE identifier='@user'",{['@model']= model,['@user']= target.identifier})
		local executed_query2 = MySQL:executeQuery("SELECT identifier FROM modelmenu WHERE identifier='@user'",{['@user']= target.identifier})
		local result = MySQL:getResults(executed_query2, {'identifier'}, "identifier")
		if result[1].identifier ~= nil then
			TriggerClientEvent("mm:changempmodel", source, model)
		else
			TriggerClientEvent("mm:changempmodel", source, model)
		end
	end)
end)

RegisterServerEvent("mm:savemodel")
AddEventHandler("mm:savemodel",function(model)
	TriggerEvent('es:getPlayerFromId', source, function(target)
		local executed_query_mp = MySQL:executeQuery("UPDATE modelmenu SET mpmodel = 1 WHERE identifier='@user'",{['@user']= target.identifier})
		local executed_query = MySQL:executeQuery("UPDATE modelmenu SET model='@model' WHERE identifier='@user'",{['@model']= model,['@user']= target.identifier})
		local executed_query2 = MySQL:executeQuery("SELECT identifier FROM modelmenu WHERE identifier='@user'",{['@user']= target.identifier})
		local result = MySQL:getResults(executed_query2, {'identifier'}, "identifier")
		if result[1].identifier ~= nil then
			TriggerClientEvent("mm:changemodel", source, model)
		else
			TriggerClientEvent("mm:changemodel", source, model)
		end
	end)
end)

RegisterServerEvent("mm:saveeverything")
AddEventHandler("mm:saveeverything",function(user)
	TriggerEvent('es:getPlayerFromId', source, function(target)
		local executed_query = MySQL:executeQuery("UPDATE modelmenu SET armour='@armour', armour_txt='@atxt', head='@head', mask='@mask', mask_txt='@mtxt', hair='@hair', hair_colour='@hcolour', shirt='@shirt', shirt_txt='@stxt', hand='@hand', shoe='@shoe', shoe_txt='@shtxt', pants='@pants', pants_txt='@ptxt', undershirt='@undershirt', undershirt_txt='@ustxt', helmet='@helmet', helmet_txt='@htxt', glasses='@glasses', glasses_txt='@gtxt', percing='@piercing', percing_txt='@petxt' WHERE identifier='@user'",{['@armour']= user.armour,['@atxt']= user.armour_txt,['@head']= user.head,['@mask']= user.mask,['@mtxt']= user.mask_txt,['@hair']= user.hair,['@hcolour']= user.hcolour,['@shirt']= user.shirt,['@stxt']= user.shirt_txt,['@hand']= user.hand,['@shoe']= user.shoe,['@shtxt']= user.shoe_txt,['@pants']= user.pants,['@ptxt']= user.pants_txt,['@undershirt']= user.undershirt,['@ustxt']= user.undershirt_txt,['@helmet']= user.helmet,['@htxt']= user.helmet_txt,['@glasses']= user.glasses,['@gtxt']= user.glasses_txt,['@piercing']= user.piercing,['@petxt']= user.piercing_txt,['@user']= target.identifier})
		local executed_query2 = MySQL:executeQuery("SELECT identifier FROM modelmenu WHERE identifier='@user'",{['@user']= target.identifier})
		local result = MySQL:getResults(executed_query2, {'identifier'}, "identifier")
		if result[1].identifier ~= nil then
			TriggerClientEvent("mm:changeeverything", source, user)
		else
			TriggerClientEvent("mm:changeeverything", source, user)
		end
	end)
end)

I hate that event shit, it’s unreliable. Everyone should write their own spawn manager anyway and take out the fivem_client.lua call (exports.spawnmanager:forceRespawn() which shouldn’t even be there really). Notice how a really important first spawn doesn’t use events? So if CitizenFX doesn’t trust events, why exactly should we? I’ve seen so much code chained to events across different resources, it’s a nightmare. You shouldn’t really be adding on random code at the end of the spawnPlayer function. The spawnPlayer function should spawn the player, and do everything that’s needed. Instead you have to search through the spawnPlayer events and see what random code is also attached on god knows what resource. Having spawnPlayer code in 2-3-4-5+ files is a cluster fuck, it should be in 1 spot only, and if you need to make changes, change the function not slap on extra code un-doing model changes or health changes or position changes that make debugging a pain in the ass. The event system was created because its easy for newbies and stops them from changing core code, but that doesn’t mean its a good idea or the best way, it’s easy, that’s it.

where’s put it?

“Sexism” lol. I just call that realistic.

agreed. its a game, don’t bring real world trash into it.

God if only the newer roleplay communities of fivem servers would understand this one simple thing… Political shit and real world trash stays outside.