Gamesnert Posted August 12, 2008 Share Posted August 12, 2008 Awwwwww Quickly! Learn about tables! Tables are l33t FTW! Link to comment
Michael_Sund Posted August 12, 2008 Author Share Posted August 12, 2008 Awwwwww Quickly! Learn about tables! Tables are l33t FTW! LOL i'm doing some c++ right now just started ut i was doing Visual Basic a time ago too =D Link to comment
Michael_Sund Posted August 12, 2008 Author Share Posted August 12, 2008 function createTeamsOnStart () teamCivilians = createTeam ( "Civilians", 194, 194, 194 ) teamCops = createTeam ( "LSPD", 101, 101, 215 ) teamArmy = createTeam ( "Army", 26, 51, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) function assignCopTeam ( player, commandName ) setPlayerTeam ( player, teamCops ) giveWeapon ( player, 31, 10000 ) giveWeapon ( player, 24, 10000 ) giveWeapon ( player, 25, 10000 ) giveWeapon ( player, 29, 10000 ) giveWeapon ( player, 17, 10000 ) giveWeapon ( player, 42, 10000 ) setPlayerArmor ( player, 0 ) setPlayerSkin ( player, 280 ) setElementPosition( player, 1552.4109, -1675.0485, 16.1953 ) setPlayerNametagColor ( player, 101, 101, 215 ) end addCommandHandler ( "imacop", assignCopTeam ) function assignArmyTeam ( player, commandName ) setPlayerTeam ( player, teamArmy ) giveWeapon ( player, 30, 10000 ) giveWeapon ( player, 22, 10000 ) giveWeapon ( player, 27, 10000 ) giveWeapon ( player, 32, 10000 ) giveWeapon ( player, 16, 10000 ) giveWeapon ( player, 44, 10000 ) setPlayerArmor ( player, 100 ) setPlayerSkin ( player, 287 ) setElementPosition( player, 2725.2253417969, -2384.9313964844, 17.213558197021 ) setPlayerNametagColor ( player, 26, 51, 0 ) end addCommandHandler ( "loginarmy", assignArmyTeam ) function assignCivilian ( player, commandName ) setPlayerTeam ( player, teamCivilians ) takeAllWeapons ( player ) setPlayerArmor ( player, 0 ) setPlayerSkin ( player, 0 ) setElementPosition( player, 2230.8967, -1159.5858, 25.8268 ) setPlayerNametagColor ( player, 255, 255, 255 ) end addCommandHandler ( "civilian", assignCivilian ) function assignNewCivilian ( ) setPlayerTeam ( source, teamCivilians ) spawnPlayer( source, 2230.8967, -1159.5858, 25.8268 ) fadeCamera ( source, true ) setPlayerNametagColor ( player, 255, 255, 255 ) end addEventHandler ( "onPlayerJoin", getRootElement(), assignNewCivilian ) function afterWasted() respawnPlayer(source, getPlayerTeam(source)) end function respawnPlayer(player, theTeam) if (theTeam == teamCops) then giveWeapon ( player, 31, 10000 ) giveWeapon ( player, 24, 10000 ) giveWeapon ( player, 25, 10000 ) giveWeapon ( player, 29, 10000 ) giveWeapon ( player, 17, 10000 ) giveWeapon ( player, 42, 10000 ) setPlayerSkin ( player, 280 ) spawnPlayer ( player, 1552.4109, -1675.0485, 16.1953 ) setPlayerNametagColor ( player, 101, 101, 215 ) elseif (theTeam == teamArmy) then giveWeapon ( player, 30, 10000 ) giveWeapon ( player, 22, 10000 ) giveWeapon ( player, 27, 10000 ) giveWeapon ( player, 32, 10000 ) giveWeapon ( player, 16, 10000 ) giveWeapon ( player, 44, 10000 ) setPlayerArmor ( player, 100 ) setPlayerSkin ( player, 287 ) spawnPlayer ( player, 2725.2253417969, -2384.9313964844, 17.213558197021 ) setPlayerNametagColor ( player, 26, 51, 0 ) elseif (theTeam == teamCivilians) then spawnPlayer ( player, 2230.8967, -1159.5858, 25.8268 ) setPlayerNametagColor ( player, 255, 255, 255 ) end end addEventHandler( "onPlayerWasted", getRootElement(), afterWasted ) function onPayday ( ) givePlayerMoney ( getRootElement(), 7000 ) end function setPaydayTimer ( ) setTimer ( onPayday, 1800000, 0 ) end addEventHandler ( "onResourceStart", getRootElement(), setPaydayTimer ) function paydayTest ( player, commandName ) setTimer ( onPayday, 5000, 1 ) end addCommandHandler ( "testpay", paydayTest ) Hmm, almost everything works, but not the function respawnPlayer, it spawns me on the right location all the time, but i don't get the skinid, weapons and other stuff only get spawned help me!!! Link to comment
Gamesnert Posted August 12, 2008 Share Posted August 12, 2008 function createTeamsOnStart () teamCivilians = createTeam ( "Civilians", 194, 194, 194 ) teamCops = createTeam ( "LSPD", 101, 101, 215 ) teamArmy = createTeam ( "Army", 26, 51, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) function assignCopTeam ( player, commandName ) setPlayerTeam ( player, teamCops ) giveWeapon ( player, 31, 10000 ) giveWeapon ( player, 24, 10000 ) giveWeapon ( player, 25, 10000 ) giveWeapon ( player, 29, 10000 ) giveWeapon ( player, 17, 10000 ) giveWeapon ( player, 42, 10000 ) setPlayerArmor ( player, 0 ) setPlayerSkin ( player, 280 ) setElementPosition( player, 1552.4109, -1675.0485, 16.1953 ) setPlayerNametagColor ( player, 101, 101, 215 ) end addCommandHandler ( "imacop", assignCopTeam ) function assignArmyTeam ( player, commandName ) setPlayerTeam ( player, teamArmy ) giveWeapon ( player, 30, 10000 ) giveWeapon ( player, 22, 10000 ) giveWeapon ( player, 27, 10000 ) giveWeapon ( player, 32, 10000 ) giveWeapon ( player, 16, 10000 ) giveWeapon ( player, 44, 10000 ) setPlayerArmor ( player, 100 ) setPlayerSkin ( player, 287 ) setElementPosition( player, 2725.2253417969, -2384.9313964844, 17.213558197021 ) setPlayerNametagColor ( player, 26, 51, 0 ) end addCommandHandler ( "loginarmy", assignArmyTeam ) function assignCivilian ( player, commandName ) setPlayerTeam ( player, teamCivilians ) takeAllWeapons ( player ) setPlayerArmor ( player, 0 ) setPlayerSkin ( player, 0 ) setElementPosition( player, 2230.8967, -1159.5858, 25.8268 ) setPlayerNametagColor ( player, 255, 255, 255 ) end addCommandHandler ( "civilian", assignCivilian ) function assignNewCivilian ( ) setPlayerTeam ( source, teamCivilians ) spawnPlayer( source, 2230.8967, -1159.5858, 25.8268 ) fadeCamera ( source, true ) setPlayerNametagColor ( player, 255, 255, 255 ) end addEventHandler ( "onPlayerJoin", getRootElement(), assignNewCivilian ) function afterWasted() respawnPlayer(source, getPlayerTeam(source)) end function respawnPlayer(player, theTeam) if (theTeam == teamCops) then giveWeapon ( player, 31, 10000 ) giveWeapon ( player, 24, 10000 ) giveWeapon ( player, 25, 10000 ) giveWeapon ( player, 29, 10000 ) giveWeapon ( player, 17, 10000 ) giveWeapon ( player, 42, 10000 ) setPlayerSkin ( player, 280 ) spawnPlayer ( player, 1552.4109, -1675.0485, 16.1953 ) setPlayerNametagColor ( player, 101, 101, 215 ) elseif (theTeam == teamArmy) then giveWeapon ( player, 30, 10000 ) giveWeapon ( player, 22, 10000 ) giveWeapon ( player, 27, 10000 ) giveWeapon ( player, 32, 10000 ) giveWeapon ( player, 16, 10000 ) giveWeapon ( player, 44, 10000 ) setPlayerArmor ( player, 100 ) setPlayerSkin ( player, 287 ) spawnPlayer ( player, 2725.2253417969, -2384.9313964844, 17.213558197021 ) setPlayerNametagColor ( player, 26, 51, 0 ) elseif (theTeam == teamCivilians) then spawnPlayer ( player, 2230.8967, -1159.5858, 25.8268 ) setPlayerNametagColor ( player, 255, 255, 255 ) end end addEventHandler( "onPlayerWasted", getRootElement(), afterWasted ) function onPayday ( ) givePlayerMoney ( getRootElement(), 7000 ) end function setPaydayTimer ( ) setTimer ( onPayday, 1800000, 0 ) end addEventHandler ( "onResourceStart", getRootElement(), setPaydayTimer ) function paydayTest ( player, commandName ) setTimer ( onPayday, 5000, 1 ) end addCommandHandler ( "testpay", paydayTest ) Hmm, almost everything works, but not the function respawnPlayer, it spawns me on the right location all the time, but i don't get the skinid, weapons and other stuff only get spawned help me!!! I did need to think, but now I'm quite ashamed I did that... giveWeapon ( player, 30, 10000 ) giveWeapon ( player, 22, 10000 ) giveWeapon ( player, 27, 10000 ) giveWeapon ( player, 32, 10000 ) giveWeapon ( player, 16, 10000 ) giveWeapon ( player, 44, 10000 ) setPlayerArmor ( player, 100 ) setPlayerSkin ( player, 287 ) spawnPlayer ( player, 2725.2253417969, -2384.9313964844, 17.213558197021 ) I would actually think that while you're dead, and someone gives me weapons and then respawns me... That I don't have those weapons. Try spawnPlayer in front of the first giveWeapon. Link to comment
Michael_Sund Posted August 18, 2008 Author Share Posted August 18, 2008 ok, sorry i haven't posted for years... but now i got probs again, i want to get some cash ingame but my snippet doesn't work function consoleGiveCash ( thePlayer, command, amount ) givePlayerMoney ( thePlayer, amount ) end addCommandHandler ( "givecash", consoleGiveCash ) Link to comment
Ace_Gambit Posted August 18, 2008 Share Posted August 18, 2008 ok, sorry i haven't posted for years...but now i got probs again, i want to get some cash ingame but my snippet doesn't work function consoleGiveCash ( thePlayer, command, amount ) givePlayerMoney ( thePlayer, amount ) end addCommandHandler ( "givecash", consoleGiveCash ) Try this. function consoleGiveCash ( thePlayer, command, amount ) givePlayerMoney ( thePlayer, tonumber(amount) or 0 ) end addCommandHandler ( "givecash", consoleGiveCash ) This converts the amount parameter to a numeric value and also makes sure that any bs input like blablabla is not crashing your script by automatically assigning 0 instead. Link to comment
Michael_Sund Posted August 18, 2008 Author Share Posted August 18, 2008 thx hope it works my server seems a little bitchy today Link to comment
Michael_Sund Posted August 18, 2008 Author Share Posted August 18, 2008 nope didn't work, damn i hate this server x'( Link to comment
50p Posted August 18, 2008 Share Posted August 18, 2008 nope didn't work, damn i hate this server x'( You must be doing something wrong. Are you sure the file with command is added to meta.xml? Are you sure the server uses the updated file? Do you get any errors in debug window ("/debugscript 3")? Link to comment
Gamesnert Posted August 18, 2008 Share Posted August 18, 2008 50P... That reminds me of something... Is this script server-side, or client-side..? And indeed do "/debugscript 3" in-game. Also, can you give all the errors/warnings/whatever your script (I mean: that section) gives? Might help. Link to comment
Michael_Sund Posted August 19, 2008 Author Share Posted August 19, 2008 i believe this can be because i added the KIHC as include to my GM, and none of the new scripts i made isn't working and kihc is a bit weird too because i get wrnings and stuff in the console, and i can't use the most of the commands in it weird Link to comment
churchill Posted August 19, 2008 Share Posted August 19, 2008 there's nothing that can't be fixed - you just need some patience, and some information to work things out. Seriously, login as your admin user on your server, and then type debugscript 3 in the console. you'll get a message to say your debugscript has been set accordingly and then you'll get some nice messages explaining where in your script things are going wrong. if that fails, start adding outputChatBox("someVariable=" .. someVariable) where someVariable is a variable you are using in your code. You do this to a) ensure your code reaches the expected point and b) check that your variable contains the value that you expect, or whether it's returning nil or false. Link to comment
Michael_Sund Posted August 19, 2008 Author Share Posted August 19, 2008 umm, debugscript 3= this error: "debugscript: Incorrect client type for this command" ???wtf Link to comment
Gamesnert Posted August 19, 2008 Share Posted August 19, 2008 And indeed do "/debugscript 3" in-game. Link to comment
Michael_Sund Posted August 20, 2008 Author Share Posted August 20, 2008 And indeed do "/debugscript 3" in-game. OH, that's so LOLOLOL that i missed it Link to comment
Michael_Sund Posted August 28, 2008 Author Share Posted August 28, 2008 Hmm, i haven't done anymore changes for the moment, you got any ideas for my server? I'll maybe clean up the script and release it today Link to comment
haybail Posted August 29, 2008 Share Posted August 29, 2008 You could do moveable gates at the teams bases. And maybe a map file to accompany the script. Link to comment
Gamesnert Posted August 29, 2008 Share Posted August 29, 2008 And is it easily editable? Not that you need to modify the entire script to get the result you want? Link to comment
Ace_Gambit Posted August 29, 2008 Share Posted August 29, 2008 I'd like to see the result too after all those people who've put effort into this thread lol. Link to comment
Gamesnert Posted August 29, 2008 Share Posted August 29, 2008 I'd like to see the result too after all those people who've put effort into this thread lol. Hehehe. I would like to see the results too. And see if it's good! A 5 pages topic... Should be good enough. Link to comment
Michael_Sund Posted August 30, 2008 Author Share Posted August 30, 2008 The only stuff which is scripted by me right now is the team like cops, army and civilians i got help by Gamesnert, Ace_Gambit, Churchill and many more, if your name isn't here it's because i got bad memory And i'm using others resources too... I got a private map file It's not really good cleaned, if someone would want to make the script better and clean it up make it easier to edit just tell me to attach the file here. But if you're gonna edit it don't delete any of the functions ^^ I would really appreciate some cleaning and fixing And BTW i was going to upload as resource but then it said wrong file format, and when i wanted to try again about 100 lines of description was gone EDIT: I have attached the files. [attachment=0]Michael's_RPG.rar[/attachment] Link to comment
Mr.Hankey Posted August 30, 2008 Share Posted August 30, 2008 it said wrong file format because you didnt zip it but used winrar instead so it became .rar and not .zip Link to comment
Gamesnert Posted August 30, 2008 Share Posted August 30, 2008 The only stuff which is scripted by me right now is the team like cops, army and civilians i got help by Gamesnert, Ace_Gambit, Churchill and many more, if your name isn't here it's because i got bad memory And i'm using others resources too... I got a private map file It's not really good cleaned, if someone would want to make the script better and clean it up make it easier to edit just tell me to attach the file here. But if you're gonna edit it don't delete any of the functions ^^ I would really appreciate some cleaning and fixing And BTW i was going to upload as resource but then it said wrong file format, and when i wanted to try again about 100 lines of description was gone EDIT: I have attached the files. [attachment=0]Michael's_RPG.rar[/attachment] Not bad, but could be better. And what does the .bak file do? ^^ And I'm actually quite scared about cops walking around with Assault Rifles+DEagles And ofcourse a soldier with 9999 Grenades... How heavy! Further more: Nice little script. I would suggest you to work some more on it. For example movable gates for the army? 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