03.06.2010, 00:54
top of gm
top of gm
OnGameModeInIt
My commands for turning it on and off
And the public for the speedboost
Код:
forward Speedboost();
Код:
new bool:SpeedBoostDisabled[MAX_PLAYERS];
Код:
SetTimer("Speedboost",200,1);
Код:
CMD:sbon(playerid,params[]) { #pragma unused params if (level[playerid] >= 4) { for(new i; i<MAX_PLAYERS;i++) { if(IsPlayerConnected(i)) { SpeedBoostDisabled[i] = true; } } } else return SendClientMessage(playerid,red,"ERROR: You need to be level 4 to use this command"); return 1; } CMD:sboff(playerid,params[]) { #pragma unused params if (level[playerid] >= 4) { for(new i; i<MAX_PLAYERS;i++) { if(IsPlayerConnected(i)) { SpeedBoostDisabled[i] = false; } } } else return SendClientMessage(playerid,red,"ERROR: You need to be level 4 to use this command"); return 1; }
Код:
public Speedboost() { for(new i; i < MAX_PLAYERS; i++) { if(SpeedBoostDisabled[i] == true) if(IsPlayerConnected(i) && !IsPlayerNPC(i)) { new Keys,up,down; GetPlayerKeys(i,Keys,up,down); if(Keys &= 1024) { if(GetPlayerState(i) == PLAYER_STATE_ONFOOT) { new Float:x,Float:y,Float:z; GetPlayerVelocity(i,x,y,z); SetPlayerVelocity(i,x+(x / 4),y+(y / 4),z+(z / 4)); } } GetPlayerKeys(i,Keys,up,down); if(Keys &= 4) { if(GetPlayerState(i) == PLAYER_STATE_DRIVER) { new Float:x,Float:y,Float:z; GetVehicleVelocity(GetPlayerVehicleID(i),x,y,z); SetVehicleVelocity(GetPlayerVehicleID(i),x+(x / 4),y+(y / 4),z+(z / 4)); } } } } return 1; }