21.10.2012, 20:54
Hey guys I have a question, I'm trying to make a system that will not allow the player walk fast.
See, when you press "W" even without you to press sprint you gonna walk really fast and you might go to faraway places in few seconds, my idea is to make the player only walk, like if the player hold "Alt", but it's not everybody that will respect and walk slowly.
So the point is, I made this function (thanks to wiki samp) and I wanna make sure that this code will not LAG my GM.
See, when you press "W" even without you to press sprint you gonna walk really fast and you might go to faraway places in few seconds, my idea is to make the player only walk, like if the player hold "Alt", but it's not everybody that will respect and walk slowly.
So the point is, I made this function (thanks to wiki samp) and I wanna make sure that this code will not LAG my GM.
PHP код:
new bool:Andando[MAX_PLAYERS];
public OnPlayerUpdate(playerid) {
new Keys,ud,lr;
GetPlayerKeys(playerid,Keys,ud,lr);
if(ud != 0 || lr != 0) {
if(Andando[playerid] == false) {
ApplyAnimation(playerid, "PED", "WALK_civi", 4.1, 1, 1, 1, 1, 1, 1);
Andando[playerid] = true;
}
}
else {
if(Andando[playerid] == true) {
ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
Andando[playerid] = false;
}
}
return 1;
}