-
Posts
525 -
Joined
-
Last visited
-
Days Won
3
Everything posted by justn
-
This should be changed to addEventHandler("onPlayerJoin",source,spawnSumoPlayer) -- Line 9 addEventHandler("onPlayerSpawn",source,spawnSumoPlayer) -- Line 35 this addEventHandler("onPlayerJoin",getRootElement(),spawnSumoPlayer) -- Line 9 addEventHandler("onPlayerSpawn",getRootElement(),spawnSumoPlayer) -- Line 35
-
He means that in debugscript3 he's seeing "Client triggered server-side event "onBuy" but event is not added server-side.
-
@SolidSnake14 Nope @WhoAmI Yes I am logged in
-
Doesn't work, I think the problem may be in the other spawn ?
-
..Ah, so can you help please ?
-
Use this when the player quit the game setAccountData Use this when the player joins the game getAccountData Use this when the player dies ( You might wanna include the variable you used for the player skin for getAccountData ) spawnPlayer
-
local skinmarker = createMarker(846.75,-2056,12.5) setElementInterior(skinmarker,15)
-
You can enter map editor and remove the objects '-' after you can save the map, add it to the gamemode's XML and to the gamemode itself and there GL
-
The problem here is, when the player spawns, he doesn't get back the weapons he had before he died. can someone fix ? I already have another code kinda like this, but it works for players who's not in a group. local playerWeapons = { } function spawn () if ( getElementData(source, "Group" ) ~= "TMZ" ) then else if not( isGuestAccount (getPlayerAccount(source)) ) then if ( not playerWeapons [ source ] ) and ( getElementData(source, "Group" ) == "TMZ" ) then playerWeapons [ source ] = { } end for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot ) if ( ammo > 0 ) then playerWeapons [ source ] [ weapon ] = ammo setTimer (spawnPlayer,5600,1,source,2296.646484375, 556.4404296875, 11.618446350098) giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ) end end end end end end addEventHandler("onPlayerWasted", getRootElement( ), spawn) addEventHandler ( "onPlayerSpawn", root, function ( ) if ( playerWeapons [ source ] ) and ( getElementData(source, "Group" ) == "TMZ" ) then for weapon, ammo in pairs ( playerWeapons [ source ] ) do giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ) end end playerWeapons [ source ] = nil end )
-
It's still not working. Update: Nevermind, Fixed it myself !
-
So i have made a group base for my group and there's a problem. when the player spawns maverick ( 487 ) it doesnt spawn in the location below, can anyone help me? No errors in debugscript 3 Client-Side addEventHandler ("onClientGUIClick", TMZGroup_Spawn, function (button, state, absoluteX, absoluteYe) trigger(getLocalPlayer()) local name = guiGridListGetItemText( TMZGroup_Gridlist, guiGridListGetSelectedItem ( TMZGroup_Gridlist ), 1 ) triggerServerEvent('TMZ', getLocalPlayer(), name) end) Server-Side AircraftIdSpawn = { { 2254.8168945313, 547.88562011719, 25.22902}, { 2334.2194824219, 544.73132324219, 25.261749267578}, } TableCars = {} addEvent('TMZ', true) addEventHandler('TMZ', root, function( nameCar ) if isElement( TableCars[source] ) then destroyElement( TableCars[source] ) end local id = getVehicleModelFromName( nameCar ) if id == 487 then local x, y, z = unpack( AircraftIdSpawn[math.random(#AircraftIdSpawn)] ) TableCars[source] = createVehicle( id, x, y, z ) if not TableCars[source] then return end warpPedIntoVehicle ( source, TableCars[source] ) setVehicleColor(veh[source], 0, 0, 150) return end local x,y,z = getElementPosition( source ) TableCars[source] = createVehicle( id, x,y,z ) if not TableCars[source] then return end warpPedIntoVehicle ( source, TableCars[source] ) addVehicleUpgrade(TableCars[source], 1147) addVehicleUpgrade(TableCars[source], 1041) addVehicleUpgrade(TableCars[source], 1035) addVehicleUpgrade(TableCars[source], 1010) addVehicleUpgrade(TableCars[source], 1171) addVehicleUpgrade(TableCars[source], 1149) end )
-
Hey, so for the first code, the problem is, the player ( who's in group RIOT ) when he dies, he does not spawn in the location specified below. addEventHandler ( "onPlayerWasted", getRootElement(), function (player) if (getElementType(player) == ("player")) then if ( getElementData ( player, "Group" ) ~= "RIOT" ) then setTimer (spawnPlayer, 1500, 1, player, 846.85522460938, -2106.7973632813, 13.618446350098, 0, getPedSkin (player), 0, 0, getPlayerTeam(player)) end end end) and for this code below, the players in group "RIOT" cant kill each other, but it does not work, Idk why I also don't get errors in debugscript but here you go. addEventHandler ( "onPlayerDamage", getRootElement (), function (attacker) if ( getElementData(attacker, "Group" ) ~= "RIOT" ) and ( getElementData(source, "Group" ) ~= "RIOT" ) then cancelEvent() end end)
-
The problem is, when the player goes into the marker, all the other players within the group gets the health and armor also, can someone fix this ? local freeHealth = createMarker( 827.14190673828, -2108.591796875, 12.618446350098, "cylinder", 2, 105, 0, 255, 85) addEventHandler ("onClientMarkerHit", freeHealth, function (hitPlayer, matchingDimension ) if not isPedInVehicle(localPlayer) and getElementData ( localPlayer , "Group" ) == groupName then setElementHealth(localPlayer,100) triggerServerEvent("onAim",localPlayer) end end) function riot () setPedArmor(source,100) end addEvent ("onAim",true) addEventHandler("onAim", getRootElement(), riot)
-
Doesn't work still, I figured out the problem now. The problem happened when i added the markers to the function on top. I removed the markers and it started to work .. So can someone help me create the markers outside of the function ? and after some seconds the gangsterMarker and policeMarker will show ?
-
So Hi, this problem is when the player hits the marker.. so, when the player its gangsterMarker, nothing happens, can fix please ? This is when created the marker function onStart () noobMark1 = createMarker ( 725.35363769531, -1276.3233642578, 14.1884375, "arrow", 1, 0, 255, 0, 85) noobmark2 = createMarker ( 691.57635498047, -1275.9288330078, 14.1884375, "arrow", 1, 0, 255, 0, 85) exports [ "TopBarChat" ] : sendClientMessage ( "the mission will start in 90 seconds !", root, 0, 0, 255, true ) setTimer(function() destroyElement(noobMark1) destroyElement(noobMark2) exports [ "TopBarChat" ] : sendClientMessage ( "the mission will be started soon !", root, 0, 0, 255, true ) local gangsterMarker = createMarker ( 725.35363769531, -1276.3233642578, 14.1884375, "arrow", 1, 255, 0, 0, 85) local policeMarker = createMarker ( 691.57635498047, -1275.9288330078, 14.1884375, "arrow", 1, 0, 0, 255, 85 ) end, 5000, 1 ) end addEventHandler("onResourceStart",resourceRoot,onStart) -- this is on marker hit addEventHandler("onMarkerHit", gangsterMarker, function (player,interior,dimension) if not isPlayerInTeam(player,"Police" ) and ( not isPlayerInTeam ( player, "Medic" ) ) then exports [ "TopBarChat" ] : sendClientMessage ( the mission Coming Soon", player, 255, 0, 0, true ) setElementInterior ( player, 5, 1300.1059570313, -792.5771484375, 1085.00778125 ) setElementDimension ( player, 5 ) setElementFrozen ( player, true ) setTimer ( function() exports [ "TopBarChat" ] : sendClientMessage ( "the mission Started !!!", player, 255, 0, 0, true ) setElementFrozen( player,false) end, 5000, 1 ) elseif isPlayerInTeam(player,"Police") then exports [ "TopBarChat" ] : sendClientMessage ( "You are a Police, you can't enter here", player, 0, 0, 255, true ) elseif isPlayerInTeam(player,"Medic") then exports [ "TopBarChat" ] : sendClientMessage ( "the mission Coming Soon", player, 0, 155, 255, true ) setElementInterior ( player, 5, 1300.1059570313, -792.5771484375, 1085.00778125 ) setElementDimension ( player, 5 ) setElementFrozen ( player, true ) setTimer ( function() setElementFrozen( player,false) end, 5000, 1 ) end end)
-
As you can see for "onPlayerWasted", it takes all of the player's weapon, so that explains your problem. So replace this addEventHandler("onPlayerWasted", root, function() local weapons = convertWeaponsToJSON(source) setElementData(source,"tempWeapons",weapons) takeAllWeapons ( source ) end ) With this local playerWeapons = { } addEventHandler ( "onPlayerWasted", root, function ( ) if not( isGuestAccount (getPlayerAccount(source)) ) then if ( not playerWeapons [ source ] ) then playerWeapons [ source ] = { } end for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot ) if ( ammo > 0 ) then playerWeapons [ source ] [ weapon ] = ammo end end end end end )
-
Instead of seconds, how do i make a time like HOUR:MINUTE:SECOND.. I've created a command, to tell how much longer a mission will start, but i just need the time.
-
@IIYAMA Loool, I'll try @WhoAmI Bug, the police doesn't get the money and for 'sendClientMessage' nothing appears for the cop, only for the criminal, everything works fine.
-
Okay i have defined source in both functions ( if i didnt in the first function then the sendClientMessage wouldnt work ) but now. i defined it, and still not working. (no errors in debugscript )
-
My bad, and i already made a new code but it's not working, IDK why function onPlayerTargetA ( theCop ) if isPlayerInTeam( theCop, "Police" ) then if not isPlayerInTeam(source, "Police" ) then if ( getPlayerWantedLevel ( source ) == 1 ) then if ( getElementType ( theCop ) == "player" ) then bindKey ( theCop, "N", "down", function() exports["TopBarChat"]:sendClientMessage("You have given "..getPlayerName(source).." a ticket , Wait for him to pay it",theCop,255, 0, 0, true) exports["TopBarChat"]:sendClientMessage("You have gotten a ticket ! Press 'H' to pay it!",source,255, 0, 0, true) bindKey ( source, "H", "down", payTheTicket ) end) end end end end end addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTargetA ) function payTheTicket (theCop) if isPlayerInTeam( theCop, "Police" ) then if not isPlayerInTeam(source, "Police" ) then if ( getPlayerWantedLevel ( source ) == 1 ) then if ( getElementType ( theCop ) == "player" ) then givePlayerMoney(theCop,200) takePlayerMoney(source,200) exports["TopBarChat"]:sendClientMessage("The ticket has been paid by "..getPlayerName(source),theCop,255, 0, 0, true) exports["TopBarChat"]:sendClientMessage("You have paid the ticket to "..getPlayerName(theCop),source,255, 0, 0, true) end end end end end
-
Source is the player who is getting the ticket... but the errors: ERROR:Police\server.lua:26:attempt to concatenate a boolean value
-
So yeah, i have made this , and the problem is, when the cop aims at the player and presses N , nothing happens, can you help please? function onPlayerTargetA ( theCop ) if isPlayerInTeam( theCop, "Police" ) then if not isPlayerInTeam(source, "Police" ) then if ( getPlayerWantedLevel ( source ) == 1 ) then if ( getElementType ( theCop ) == "player" ) then bindKey ( theCop, "N", "down", function() exports["TopBarChat"]:sendClientMessage("You have given "..getPlayerName(source).." a ticket , Wait for him to pay it",theCop,255, 0, 0, true) exports["TopBarChat"]:sendClientMessage("You have gotten a ticket ! Press 'H' to pay it!",source,255, 0, 0, true) bindKey ( source, "H", "down", payTheTicket ) end) end end end end end addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTargetA ) function payTheTicket (theCop) if isPlayerInTeam( theCop, "Police" ) then if not isPlayerInTeam(source, "Police" ) then if ( getPlayerWantedLevel ( source ) == 1 ) then if ( getElementType ( theCop ) == "player" ) then givePlayerMoney(theCop,200) takePlayerMoney(source,200) exports["TopBarChat"]:sendClientMessage("The ticket has been paid by "..getPlayerName(source),theCop,255, 0, 0, true) exports["TopBarChat"]:sendClientMessage("You have paid the ticket to "..getPlayerName(theCop),source,255, 0, 0, true) end end end end end