...
The problem is that there's absolutely
no logic!
There are two blatantly obvious scenarios that need to be addressed:
1. Player changes hat
2. Player is wearing hat already
PHP Code:
//#CLIENTSIDE
function onCreated() {
// Check if player is wearing hat
if (player.attr[1] == "hat.png") {
speedUP();
}
}
function onWeaponFired() {
// Check if player is wearing the hat already
if (player.attr[1] == "hat.png") {
// Remove hat
player.attr[1] = "nohat.png";
speedDOWN();
} else {
// Put on hat
player.attr[1] = "hat.png";
speedUP();
}
}
That being said the problem is that the speed changing is being done primarily in each hat weapon (and the obvious security issue with the triggerserver). This work would be better off calculated in the movement system or through a "buff" system that the movement system interacts with.
Please also read and search through:
http://wiki.graal.net/index.php/Creation/Dev/GScript