xeon17 Posted May 16, 2014 Share Posted May 16, 2014 function onSpawn ( ) takeAllWeapons ( source ) giveWeapon ( source, 24, 100 ) local playerTeam = getPlayerTeam(source) if (playerTeam) then local r, g, b = getTeamColor(playerTeam) local myBlip = createBlipAttachedTo ( source, 0 , 2 , r,g,b ) setPedStat ( source, 73, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 71, 1000 ) setPedStat ( source, 75, 1000 ) giveWeapon ( source, 26, 100 ) setPedStat ( source, 77, 1000 ) setPedStat ( source, 78, 1000 ) giveWeapon ( source, 32, 100 ) giveWeapon ( source, 31, 150 ) giveWeapon ( source, 46, 200 ) givePlayerMoney ( source, 5000 ) end end addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) function onPlayerQuit () destroyBlipsAttachedTo ( source ) end function onPlayerWasted ( ) destroyBlipsAttachedTo ( source ) end addEventHandler ( "onPlayerQuit", getRootElement(), onPlayerQuit ) function Blip ( ) local playerTeam = getPlayerTeam(source) if ( not playerTeam) then local MeuBlip = createBlipAttachedTo ( source, 0 , 2 , 255,255,255 ) end end addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) Blips for players without gang no work , and when players quit they blip no destroy.. can someone help me please Link to comment
Karuzo Posted May 16, 2014 Share Posted May 16, 2014 local r, g, b local blip function onSpawn ( ) takeAllWeapons ( source ) giveWeapon ( source, 24, 100 ) local playerTeam = getPlayerTeam(source) if (playerTeam) then r, g, b = getTeamColor(playerTeam) blip = createBlipAttachedTo ( source, 0 , 2 , r,g,b ) setPedStat ( source, 73, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 71, 1000 ) setPedStat ( source, 75, 1000 ) giveWeapon ( source, 26, 100 ) setPedStat ( source, 77, 1000 ) setPedStat ( source, 78, 1000 ) giveWeapon ( source, 32, 100 ) giveWeapon ( source, 31, 150 ) giveWeapon ( source, 46, 200 ) givePlayerMoney ( source, 5000 ) else r,g,b = 255,255,255 blip = createBlipAttachedTo ( source, 0 , 2 , r,g,b ) end end addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) function onPlayerQuit () destroyElement ( blip ) end function onPlayerWasted ( ) destroyElement ( blip ) end addEventHandler ( "onPlayerQuit", getRootElement(), onPlayerQuit ) Link to comment
codeluaeveryday Posted May 16, 2014 Share Posted May 16, 2014 I'm sure KRZO's one will not work, here: local pBlips = {} function onSpawn ( ) takeAllWeapons ( source ) giveWeapon ( source, 24, 100 ) local playerTeam = getPlayerTeam(source) if (playerTeam) and not pBlips[source] then local r, g, b = getTeamColor(playerTeam) local myBlip = createBlipAttachedTo ( source, 0 , 2 , r,g,b ) pBlips[source] = myBlip setPedStat ( source, 73, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 71, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 77, 1000 ) setPedStat ( source, 78, 1000 ) giveWeapon ( source, 26, 100 ) giveWeapon ( source, 32, 100 ) giveWeapon ( source, 31, 150 ) giveWeapon ( source, 46, 200 ) givePlayerMoney ( source, 5000 ) elseif pBlips[source] then destroyPlayerBlip(source) end end function destroyPlayerBlip(pElement) local theElement = (pElement and getElementType(pElement) == 'player' and pElement) or source if pBlips[theElement] then destroyElement(pBlips[theElement]) pBlips[theElement] = nil end end addEventHandler("onPlayerSpawn", getRootElement(), onSpawn) addEventHandler("onPlayerWasted", getRootElement(), destroyPlayerBlip) addEventHandler("onPlayerQuit", getRootElement(), destroyPlayerBlip) Link to comment
xeon17 Posted May 16, 2014 Author Share Posted May 16, 2014 none of your two code work nothing happen Krzo's one have a bug [2014-05-16 13:31:39] WARNING: [ST]Spawn\Spawn.lua:28: Bad argument @ 'getElementType' [Expected element at argument 1, got number '0'] [2014-05-16 13:31:50] ERROR: scores\scores.lua:93: attempt to perform arithmetic on a boolean value [2014-05-16 13:31:50] WARNING: [ST]Spawn\Spawn.lua:28: Bad argument @ 'getElementType' [Expected element at argument 1, got number '233'] Link to comment
codeluaeveryday Posted May 17, 2014 Share Posted May 17, 2014 local pBlips = {} function onSpawn ( ) takeAllWeapons ( source ) giveWeapon ( source, 24, 100 ) local playerTeam = getPlayerTeam(source) if (playerTeam) and not pBlips[source] then local r, g, b = getTeamColor(playerTeam) local myBlip = createBlipAttachedTo ( source, 0 , 2 , r,g,b ) pBlips[source] = myBlip setPedStat ( source, 73, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 71, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 77, 1000 ) setPedStat ( source, 78, 1000 ) giveWeapon ( source, 26, 100 ) giveWeapon ( source, 32, 100 ) giveWeapon ( source, 31, 150 ) giveWeapon ( source, 46, 200 ) givePlayerMoney ( source, 5000 ) elseif pBlips[source] then destroyPlayerBlip(source) end end function destroyPlayerBlip(pElement) local theElement = source or pElement if pBlips[theElement] then destroyElement(pBlips[theElement]) pBlips[theElement] = nil end end addEventHandler("onPlayerSpawn", getRootElement(), onSpawn) addEventHandler("onPlayerWasted", getRootElement(), destroyPlayerBlip) addEventHandler("onPlayerQuit", getRootElement(), destroyPlayerBlip) Link to comment
xeon17 Posted May 17, 2014 Author Share Posted May 17, 2014 no work nothing in debug this time. local pBlips = {} function onSpawn ( ) takeAllWeapons ( source ) setPlayerMoney ( source, 0 ) giveWeapon ( source, 24, 100 ) setPedStat ( source, 73, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 71, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 77, 1000 ) setPedStat ( source, 78, 1000 ) giveWeapon ( source, 26, 100 ) giveWeapon ( source, 32, 100 ) giveWeapon ( source, 31, 150 ) giveWeapon ( source, 46, 200 ) givePlayerMoney ( source, 5000 ) local playerTeam = getPlayerTeam(source) if (playerTeam) and not pBlips[source] then local r, g, b = getTeamColor(playerTeam) local myBlip = createBlipAttachedTo ( source, 0 , 2 , r,g,b ) pBlips[source] = myBlip elseif pBlips[source] then destroyPlayerBlip(source) end end function destroyPlayerBlip(pElement) local theElement = source or pElement if pBlips[theElement] then destroyElement(pBlips[theElement]) pBlips[theElement] = nil end end addEventHandler("onPlayerSpawn", getRootElement(), onSpawn) addEventHandler("onPlayerWasted", getRootElement(), destroyPlayerBlip) addEventHandler("onPlayerQuit", getRootElement(), destroyPlayerBlip) Link to comment
xeon17 Posted May 17, 2014 Author Share Posted May 17, 2014 Can someone fix the script please i really need it Link to comment
xXMADEXx Posted May 17, 2014 Share Posted May 17, 2014 You can try this: local pBlips = {} function onSpawn ( p ) if ( not source or not isElement ( source ) and p and isElement ( p ) ) then source = p end takeAllWeapons ( source ) setPlayerMoney ( source, 0 ) giveWeapon ( source, 24, 100 ) setPedStat ( source, 73, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 71, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 77, 1000 ) setPedStat ( source, 78, 1000 ) giveWeapon ( source, 26, 100 ) giveWeapon ( source, 32, 100 ) giveWeapon ( source, 31, 150 ) giveWeapon ( source, 46, 200 ) givePlayerMoney ( source, 5000 ) local playerTeam = getPlayerTeam(source) if (playerTeam) and not pBlips[source] then local r, g, b = getTeamColor(playerTeam) local myBlip = createBlipAttachedTo ( source, 0 , 2 , r,g,b ) pBlips[source] = myBlip elseif pBlips[source] then destroyPlayerBlip(source) end end function destroyPlayerBlip(pElement) local theElement = source or pElement if pBlips[theElement] then destroyElement(pBlips[theElement]) pBlips[theElement] = nil end end addEventHandler("onPlayerSpawn", getRootElement(), onSpawn) addEventHandler("onPlayerWasted", getRootElement(), destroyPlayerBlip) addEventHandler("onPlayerQuit", getRootElement(), destroyPlayerBlip) addEventHandler ( 'onResourceStart', resourceRoot, function ( ) for _, p in pairs ( getElementsByType ( "player" ) ) do onSpawn ( p ) end end ) Link to comment
#RooTs Posted May 18, 2014 Share Posted May 18, 2014 give-me Screen Capture of RESOURCE IN mta Link to comment
xeon17 Posted May 18, 2014 Author Share Posted May 18, 2014 why the script no work, can someone help me Link to comment
Castillo Posted May 18, 2014 Share Posted May 18, 2014 Do you get any errors with xXMADEXx's code? Link to comment
xeon17 Posted May 19, 2014 Author Share Posted May 19, 2014 I'll post the full code , because i edited the script a little. I tried to make that players without gang have a blip too. but no work , of couse local pBlips = {} function onSpawn ( p ) if ( not source or not isElement ( source ) and p and isElement ( p ) ) then source = p end takeAllWeapons ( source ) setPlayerMoney ( source, 0 ) giveWeapon ( source, 24, 100 ) setPedStat ( source, 73, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 71, 1000 ) setPedStat ( source, 75, 1000 ) setPedStat ( source, 77, 1000 ) setPedStat ( source, 78, 1000 ) giveWeapon ( source, 26, 100 ) giveWeapon ( source, 32, 100 ) giveWeapon ( source, 31, 150 ) giveWeapon ( source, 46, 200 ) givePlayerMoney ( source, 5000 ) local playerTeam = getPlayerTeam(source) if (playerTeam) and not pBlips[source] then local r, g, b = getTeamColor(playerTeam) local myBlip = createBlipAttachedTo ( source, 0 , 10 , r,g,b ) pBlips[source] = myBlip elseif pBlips[source] then destroyPlayerBlip(source) end end function destroyPlayerBlip(pElement) local theElement = source or pElement if pBlips[theElement] then destroyElement(pBlips[theElement]) pBlips[theElement] = nil end end addEventHandler("onPlayerSpawn", getRootElement(), onSpawn) addEventHandler("onPlayerQuit", getRootElement(), destroyPlayerBlip) addEventHandler("onPlayerWasted", getRootElement(), destroyPlayerBlip) addEventHandler ( 'onResourceStart', resourceRoot, function ( ) for _, p in pairs ( getElementsByType ( "player" ) ) do onSpawn ( p ) end end ) function Blip ( ) local playerTeam = getPlayerTeam(source) if ( not playerTeam) then local MeuBlip = createBlipAttachedTo ( source, 0 , 2 , 255,255,255 ) end end addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) ERROR with code of xMADEx : [2014-05-19 08:06:16] WARNING: [ST]Spawn\Spawn.lua:21: Bad 'player' pointer @ 'getPlayerTeam'(1) Link to comment
TAPL Posted May 19, 2014 Share Posted May 19, 2014 local pBlips = {} function onSpawn(player) takeAllWeapons(player) setPlayerMoney(player, 0) giveWeapon(player, 24, 100) setPedStat(player, 73, 1000) setPedStat(player, 75, 1000) setPedStat(player, 71, 1000) setPedStat(player, 75, 1000) setPedStat(player, 77, 1000) setPedStat(player, 78, 1000) giveWeapon(player, 26, 100) giveWeapon(player, 32, 100) giveWeapon(player, 31, 150) giveWeapon(player, 46, 200) givePlayerMoney(player, 5000) if pBlips[player] then destroyElement(pBlips[player]) pBlips[player] = nil end local playerTeam = getPlayerTeam(player) if (playerTeam) then local r, g, b = getTeamColor(playerTeam) pBlips[player] = createBlipAttachedTo(player, 0, 10, r, g, b) else pBlips[player] = createBlipAttachedTo(player, 0, 10, 255, 255, 255) end end function destroyPlayerBlip() if pBlips[source] then destroyElement(pBlips[source]) pBlips[source] = nil end end addEventHandler("onPlayerSpawn", root, function() onSpawn(source) end) addEventHandler("onPlayerQuit", root, destroyPlayerBlip) addEventHandler("onPlayerWasted", root, destroyPlayerBlip) addEventHandler("onResourceStart", resourceRoot, function() for _, p in ipairs(getElementsByType("player")) do onSpawn(p) end end) Link to comment
xeon17 Posted May 19, 2014 Author Share Posted May 19, 2014 Thanks , but can you add that player blips update every 5 seconds , because if the player change gang he have wrong blip color ._. Thanks TAPL Link to comment
TAPL Posted May 19, 2014 Share Posted May 19, 2014 How the player able to change the gang? Link to comment
xeon17 Posted May 19, 2014 Author Share Posted May 19, 2014 When player change gang he got other nametag color and his blip color should be like that gang color. extample i'm CRIME (red color) and i'm leave crime and join LEI (blue color) my blip color will be still red. Link to comment
WASSIm. Posted May 19, 2014 Share Posted May 19, 2014 i think that should to be better and what do you want local stats = {73, 75, 71, 77, 78} local weapons = {[24] = 100, [26] = 100, [32] = 100, [31] = 150, [46] = 200} local pBlips = {} addEventHandler("onPlayerSpawn", root, function (source) takeAllWeapons(source) setPlayerMoney(source, 0) givePlayerMoney(source, 5000) for _, stat in ipairs(stats) do setPedStat(source, 73, 1000) end for weapon, ammo in pairs(weapons) do giveWeapon(source, weapon, ammo) end pBlips[source] = createBlipAttachedTo(source, 0, 2) end addEventHandler("onResourceStart", resourceRoot, function() for _, player in ipairs(getElementsByType("player")) do if not (isPlayerDead(player)) then pBlips[source] = createBlipAttachedTo(player, 0, 2) end end end) -- Blip system setTimer(function() for player, blip in ipairs(pBlips) do if (isElement(player)) and not (isPlayerDead(player)) then local playerTeam = getPlayerTeam(player) if (playerTeam) then local r, g, b = getTeamColor(playerTeam) setBlipColor(blip, r, g, b) else setBlipColor(blip, 255, 255, 255) end else destroyElement(blip) pBlips[player] = nil end end end, 5000, 0) Link to comment
xeon17 Posted May 19, 2014 Author Share Posted May 19, 2014 You got a lot of errors there. fix them then , heuheuheu , joke. i'll try the script soon and answer here about the results. Link to comment
TAPL Posted May 19, 2014 Share Posted May 19, 2014 Try this. local stats = {73, 75, 71, 77, 78} local weapons = {[24] = 100, [26] = 100, [32] = 100, [31] = 150, [46] = 200} local pBlips = {} addEventHandler("onPlayerSpawn", root, function() takeAllWeapons(source) setPlayerMoney(source, 5000) --givePlayerMoney(source, 5000) for _, stat in ipairs(stats) do setPedStat(source, stat, 1000) end for weapon, ammo in pairs(weapons) do giveWeapon(source, weapon, ammo) end if not pBlips[source] then pBlips[source] = createBlipAttachedTo(source, 0, 2) end end) addEventHandler("onResourceStart", resourceRoot, function() for _, player in ipairs(getElementsByType("player")) do if not (isPlayerDead(player)) then pBlips[player] = createBlipAttachedTo(player, 0, 2) end end end) -- Blip system setTimer(function() for player, blip in pairs(pBlips) do if (isElement(player)) then local playerTeam = getPlayerTeam(player) if (playerTeam) then local r, g, b = getTeamColor(playerTeam) setBlipColor(blip, r, g, b, 255) else setBlipColor(blip, 255, 255, 255, 255) end else destroyElement(blip) pBlips[player] = nil end end end, 5000, 0) Link to comment
xeon17 Posted May 19, 2014 Author Share Posted May 19, 2014 Without bugs & problem , everything good thanks TAPL & Wassim , problem solved. TAPL please take a eye on this ._. > viewtopic.php?f=91&t=75303&start=30 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now