Jump to content

RP Game Mode Help/Progress topic "RPG Server (ALPHA STAGE)"


Recommended Posts

  • Replies 142
  • Created
  • Last Reply

Top Posters In This Topic

Posted
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!!!

Posted
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... :S

           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.

Posted

ok, sorry i haven't posted for years...

but now i got probs again, i want to get some cash ingame :P

but my snippet doesn't work

function consoleGiveCash ( thePlayer, command, amount ) 
        givePlayerMoney ( thePlayer, amount ) 
end 
addCommandHandler ( "givecash", consoleGiveCash  ) 

Posted
ok, sorry i haven't posted for years...

but now i got probs again, i want to get some cash ingame :P

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.

Posted
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")?

Posted

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.

Posted

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 :S weird

Posted

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.

  • 2 weeks later...
Posted
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! :D

A 5 pages topic... Should be good enough. :D

Posted

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 xD

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 :P

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]

Posted
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 xD

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 :P

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 xD

And ofcourse a soldier with 9999 Grenades... How heavy! :o

Further more: Nice little script. ;)

I would suggest you to work some more on it. For example movable gates for the army? ;)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...