about cpu
#6

top of gm
Код:
forward Speedboost();
top of gm
Код:
new bool:SpeedBoostDisabled[MAX_PLAYERS];
OnGameModeInIt
Код:
SetTimer("Speedboost",200,1);
My commands for turning it on and off

Код:
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;
}
And the public for the speedboost

Код:
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;
}
Reply


Messages In This Thread
about cpu - by [SF]RobMob - 02.06.2010, 20:23
Re: about cpu - by Agent Smith - 02.06.2010, 20:30
Re: about cpu - by azzerking - 02.06.2010, 21:14
Re: about cpu - by [SF]RobMob - 03.06.2010, 00:35
Re: about cpu - by Calgon - 03.06.2010, 00:42
Re: about cpu - by [SF]RobMob - 03.06.2010, 00:54

Forum Jump:


Users browsing this thread: 1 Guest(s)