![]() |
Spar Script Awarding Dead player
This spar script im doing works completely, until you get to where it keeps track of the streak for the player that wins. It does set a number each time someone dies and the spar is over, but it awards the player that lost/dies with the streak and puts not just 1 win up per spar, but as many of a # that is in the level instead. So if there are 4 people in the level, and someone loses a spar, it says they have won 4 spars, per that one spar. Dunno why, i know im missing something stupid.
PHP Code:
|
Just a suggestion: if you create a new piece of code directly testing the problem, it will be a lot clearer to you, as well as a lot easier for someone to help. There is too much going on in that code and it looks a lot of work to find a bug.
|
Why are you storing your information in serverr.sparline when level.sparline or even this.sparline would be just as effective. The only reason I can think of is that you want to be able to edit people out of the line through RC or from another level which is unnecessary.
|
Well the script may work for now, but a level NPC joined to a spar would be more effective and easier to manage considering it could easily be done with server-side events.
onPlayerChats() onPlayerLogin(acct) onPlayerLogout(acct) onPlayerKilled(victim, killer) onPlayerLeaves() Apply some logic, in the form of if statements and you got yourself a solid spar script. Just something to think about. |
I wanted it serverr.foobar vars so people can join the line from anywhere and be warped in on their turn. So unless using a dbnpc is more effecient, i dont really see another way to do that. And for debug and help purposes on here, just start on the function onPlayerDies under clientside and follow where it leads.
|
I was looking this over and noticed something:
PHP Code:
PHP Code:
|
temp.good is params[1] serverside, so it is being used. The problem for my code relies in the way that temp.good is being set I think (but it could be the serverside part and how params[1] is used just not sure), its just not setting to the winner of the spar, and the loser instead. Does anyone see why that is happening?
|
Quote:
|
Ok, so tried changing some things, this is what I got. Completely disregarded trying to send the winner, since the winner is still left in serverr.sparring[0] until they leave the spar area, it can add it that way. Now it adds to the correct one, but simply adds two wins instead of one on each win, still dont see why either.
PHP Code:
|
While player.chat does work when you're debugging your best bet in this scenario would be to use echos, preferably at the top like so:
PHP Code:
Hint: Your problem lies in your server-side players for loop. |
Lol, i do suppose there is no reason to search players for one being dead after its done in a function. xD Thanks for the help.
|
Ok, so I learned a valuable lesson here in logic. You cant have a weapon, and expect 2 different players to effect each others values on their player and weapon. Needed to use serverr.foobars to set it while the spar was going on, so it could be true/false, and people could leave the spar appropriately. :)
thanks to everyones help. |
All times are GMT +2. The time now is 05:55 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.