Quote
public OnRaceSelected(client, newrace) {
if (newrace != thisRaceID) {
// Reset the passive skills of race (sometimes contains a lot of code and checks)
// This code is executed every time a player changes the race
// The more races on the server, the more code is executed when the player changes the race (there are lags)
} else {
// Activate race's skills
}
}
if (newrace != thisRaceID) {
// Reset the passive skills of race (sometimes contains a lot of code and checks)
// This code is executed every time a player changes the race
// The more races on the server, the more code is executed when the player changes the race (there are lags)
} else {
// Activate race's skills
}
}
I suggest adding in OnRaceSelected event new parameter "oldrace":
/**
* Gets called when someone changes their race.
* @param client: The client's index.
* @param newrace: The player's new race.
* @param oldrace: The player's old race.
*/
forward OnRaceSelected(client, newrace, oldrace);
Now slightly different picture:
Quote
public OnRaceSelected(client, newrace, oldrace) {
if (newrace != thisRaceID && oldrace == thisRaceID) {
// Reset the passive skills of race (sometimes contains a lot of code and checks)
} else if (newrace == thisRaceID) {
// Activate race's skills
}
}
if (newrace != thisRaceID && oldrace == thisRaceID) {
// Reset the passive skills of race (sometimes contains a lot of code and checks)
} else if (newrace == thisRaceID) {
// Activate race's skills
}
}
I think this will solve the problem. What do you think about this?







Logged


DarkEnergy
