AHSS Posted March 23, 2011 Author Share Posted March 23, 2011 (edited) @proracer no i meant in a command like /slap /kick i mean /goto and i write the id of a player not the name possible thanks thanks solidsnake Edited March 23, 2011 by Guest Link to comment
Castillo Posted March 23, 2011 Share Posted March 23, 2011 Oh and btw, about respawning (i forgot o,o) addEventHandler("onPlayerWasted",getRootElement(), function () local x = 2228.9583 local y = -1722.1108 local z = 13.5625 setTimer(spawnPlayer,2000,1,source,x,y,z) outputChatBox("You will respawn in 2 seconds!",source,255,0,0) end) It should work. Link to comment
AHSS Posted March 23, 2011 Author Share Posted March 23, 2011 ok solid snake thanks but how to make the gate automatic like when the player is in a certain position the gate moves meaning i wanna know how to check if the player is near a certain pos thanks Link to comment
Castillo Posted March 23, 2011 Share Posted March 23, 2011 Use colshapes, https://wiki.multitheftauto.com/wiki/OnColShapeHit https://wiki.multitheftauto.com/wiki/CreateColRectangle Link to comment
AHSS Posted March 23, 2011 Author Share Posted March 23, 2011 ok i will try also i did this function RespawnPlayer() setTimer(SpawnPlayerAgain, 3000, 1) end addEventHandler("onPlayerWasted", RespawnPlayer) function SpawnPlayerAgain() local x = 2228.9583 local y = -1722.1108 local z = 13.5625 succes = spawnPlayer(source, x, y, z) if(succes) then outputChatBox("Yay! Alpha Fixed The Respawn hes soo fucken happy can u plz thank him??", source, 0, 255, 0, true) else outputChatBox("OMG Alpha failed to fix the spawn thingy tell him plz", source, 0, 0, 255, true) end end but it didnt work why?? thanks Link to comment
Castillo Posted March 23, 2011 Share Posted March 23, 2011 function RespawnPlayer() setTimer(SpawnPlayerAgain, 3000, 1, source) end addEventHandler("onPlayerWasted", RespawnPlayer) function SpawnPlayerAgain(player) local x = 2228.9583 local y = -1722.1108 local z = 13.5625 succes = spawnPlayer(player, x, y, z) if(succes) then outputChatBox("Yay! Alpha Fixed The Respawn hes soo happy can u plz thank him??", player, 0, 255, 0, true) else outputChatBox("OMG Alpha failed to fix the spawn thingy tell him plz", player, 0, 0, 255, true) end end You forgot to pass the "source" element with setTimer, source element is the player who died. Link to comment
AHSS Posted March 23, 2011 Author Share Posted March 23, 2011 ok it worked but when the player spawns hes still dead yeah he spawns but dead not alive the camera keep doing the same why?? i tried setelement health but hes still dead ------------------------------- edit: idk whats going on it doesnt work at all the player doesnt spawns at all Link to comment
Castillo Posted March 23, 2011 Share Posted March 23, 2011 function RespawnPlayer() setTimer(SpawnPlayerAgain, 3000, 1, source) end addEventHandler("onPlayerWasted", RespawnPlayer) function SpawnPlayerAgain(player) local x = 2228.9583 local y = -1722.1108 local z = 13.5625 succes = spawnPlayer(player, x, y, z) if(succes) then outputChatBox("Yay! Alpha Fixed The Respawn hes soo happy can u plz thank him??", player, 0, 255, 0, true) fadeCamera(player,true) else outputChatBox("OMG Alpha failed to fix the spawn thingy tell him plz", player, 0, 0, 255, true) end end Link to comment
AHSS Posted March 23, 2011 Author Share Posted March 23, 2011 it doesnt work the player dies the camera keeps going up and up and nothing happens i just copied what u typed Link to comment
Castillo Posted March 23, 2011 Share Posted March 23, 2011 that's because you forgot to add getRootElement to RespawnPlayer function RespawnPlayer() setTimer(SpawnPlayerAgain, 3000, 1, source) end addEventHandler("onPlayerWasted", getRootElement(), RespawnPlayer) function SpawnPlayerAgain(player) local x = 2228.9583 local y = -1722.1108 local z = 13.5625 succes = spawnPlayer(player, x, y, z) if(succes) then outputChatBox("Yay! Alpha Fixed The Respawn hes soo happy can u plz thank him??", player, 0, 255, 0, true) fadeCamera(player,true) else outputChatBox("OMG Alpha failed to fix the spawn thingy tell him plz", player, 0, 0, 255, true) end end Link to comment
AHSS Posted March 23, 2011 Author Share Posted March 23, 2011 thanks it worked col shape is so hard and weird i dont understand how it work doesnt MTA contains if is player in range of certain position ------------------------------------------ edit: if i want to make a reason cmd how to make it i made 1 like that function SlapPlayer(theplayer, command, otherplayername, reason) otherplayer = getPlayerFromName(otherplayername) local x, y, z = getElementPosition(otherplayer) local pname = getPlayerName(theplayer) local gname = getPlayerName(otherplayer) z = z+5 succes = setElementPosition(otherplayer, x, y, z) if(succes) then outputChatBox(gname.." Was Slapped By Admin "..pname.." Reason : "..reason, getRootElement(), 255, 0, 0, true) else outputChatBox("Failed", theplayer) end end addCommandHandler("sslap", SlapPlayer) ok it works but the reason is only 1 word i can make it SlapPlayer(theplayer, command, otherplayername, reason1, reason2, reason3, reason4) but i gues there is more efficent way? plz help thanks Link to comment
Discord Moderators Zango Posted March 24, 2011 Discord Moderators Share Posted March 24, 2011 function SlapPlayer(theplayer, command, otherplayername, ...) otherplayer = getPlayerFromName(otherplayername) local x, y, z = getElementPosition(otherplayer) local pname = getPlayerName(theplayer) local gname = getPlayerName(otherplayer) z = z+5 succes = setElementPosition(otherplayer, x, y, z) if(succes) then outputChatBox(gname.." Was Slapped By Admin "..pname.." Reason : "..table.concat ({...}, ' '), getRootElement(), 255, 0, 0, true) else outputChatBox("Failed", theplayer) end end addCommandHandler("sslap", SlapPlayer) you add 'everything else' '...' into a table and concatenate the values, separated by space into a string Link to comment
AHSS Posted March 24, 2011 Author Share Posted March 24, 2011 ok thanks but still is there is something instead of col hit? like if is player in range of point? col hit is soo hard and creating a col i weird is there is any way else?? ----------------------------------------- answer the above too plz guys alsp please answer the id thing can i use players id instead of name in the commands? like /slap can i? Link to comment
Moderators Citizen Posted March 24, 2011 Moderators Share Posted March 24, 2011 col hit is soo hard and creating a col i weird is there is any way else?? Yes you can use that function: local distance = getDistanceBetweenPoints3D( playerX, playerY, playerZ, gateX, gateY, gateZ ) if distance <= 15 then openGate() end But it's more difficult and need more CPU( due to the setTimer ) than this: shapeGate = createColTube( gateX, gateY, gateZ, 15, 10 ) function openGate() -- open the gate end addEventHandler("onColShapeHIT", shapeGate, openGate ) Link to comment
Moderators Citizen Posted March 24, 2011 Moderators Share Posted March 24, 2011 answer the above too plzguys alsp please answer the id thing can i use players id instead of name in the commands? like /slap can i? You can use the player's ID only if you set a unique ID for the player when he joins the server ( or at the spawn or at the login; like you want ), then: function SlapPlayer(theplayer, command, otherplayername, ...) otherplayer = getPlayerFromName( tostring(otherplayername) ) or getElementByID( tostring(otherplayername) ) -- if you specify an ID, getPlayerFromName return false and getElementByID return the player if the player's ID is correct so ... -- otherplayer = false or thePlayerElement -- so otherplayer = thePlayerElement local x, y, z = getElementPosition(otherplayer) local pname = getPlayerName(theplayer) local gname = getPlayerName(otherplayer) z = z+5 succes = setElementPosition(otherplayer, x, y, z) if(succes) then outputChatBox(gname.." Was Slapped By Admin "..pname.." Reason : "..table.concat ({...}, ' '), getRootElement(), 255, 0, 0, true) else outputChatBox("Failed", theplayer) end end addCommandHandler("sslap", SlapPlayer) ( I made another post because the forum said that there are too few characters in my post --' ) Link to comment
AHSS Posted March 24, 2011 Author Share Posted March 24, 2011 ok can i make a player in two teams?? yes or no thanks ---------------------------- edit: also if the above is possible how to kick him from 1 team but not from the other team ------------------------------- edit: ok i knew its impossible ok then how to make admins and teams? how to make a player admin and in a certain tea, thanks plz help me Link to comment
Moderators Citizen Posted March 25, 2011 Moderators Share Posted March 25, 2011 how to make a player admin and in a certain tea, thanks plz help me setElementData( yourPlayer, "Admin", 1 ) -- then if getElementData( yourPlayer, "Admin" ) ~= false then -- if is an admin then -- do something end --------- Expulse him from the AdminTeam: removeElementData( yourPlayer, "Admin" ) -- destroy the elementData -- or setElementData( yourPlayer, "Admin", false ) -- Keep the elementData in the memory but know that player isn't an admin 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