Help me :( .
#1

It only fired once
I edited " FireShot[playerid] = 1; = FireShot[playerid] = 999999; "
But it still only once
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(GetPVarInt(playerid, "Injured") == 1) return 1;
	if(newkeys & KEY_FIRE)
	{
	    if(GetPVarInt(playerid, "EventToken") >= 1)
	    {
	        if(CarShooting[playerid] == 1)
	        {
				if(IsPlayerInAnyVehicle(playerid) && FireShot[playerid] == 0 && !IsValidObject(gRocketObj[playerid]))   // Only run the code if the object doesn't already exist, otherwise more objects will take up gRocketObj and the previous ones won't be deleted
			    {
					new
					vehicleid = GetPlayerVehicleID(playerid),
			        Float:x,
			        Float:y,
			        Float:z,
			        Float:r,
			        Float:dist = 50.0,
			        Float:tmpang,
			        Float:tmpx,
			        Float:tmpy,
			        Float:tmpz;

					FireShot[playerid] = 1;
					SetTimerEx("ShotFire", 1000, 0, "i", playerid);
					GetVehiclePos(vehicleid, x, y, z);
					GetVehicleZAngle(vehicleid, r);
					gRocketObj[playerid] = CreateObject(345, x, y, z, 0, 0, r);

					for(new i;i<MAX_PLAYERS;i++)
					{
					    if(i == playerid)continue;
					    if(IsPlayerInRangeOfPoint(i, 50.0, x, y, z))
					    {
					        GetPlayerPos(i, tmpx, tmpy, tmpz);

					        tmpang = (90-atan2(tmpy-y, tmpx-x));
					        if(tmpang < 0)tmpang = 360.0+tmpang;
					        tmpang = 360.0 - tmpang;

				            if( floatabs(tmpang-r) < 5.0)
				            {
				                dist = GetPlayerDistanceFromPoint(i, x, y, z);
				            }
					    }
					}
				MoveObject(gRocketObj[playerid],x + (dist * floatsin(-r, degrees)),y + (dist * floatcos(-r, degrees)),z,100.0);                             // Nice and fast!
			    }
			}
		}
		else if (PlayerInfo[playerid][pAdmin] >= 4)
		{
		    if(CarShooting[playerid] == 1)
	        {
				new vehicleid = GetPlayerVehicleID(playerid);
				if(GetVehicleModel(vehicleid) == 564 && FireShot[playerid] == 0 && !IsValidObject(gRocketObj[playerid]))   // Only run the code if the object doesn't already exist, otherwise more objects will take up gRocketObj and the previous ones won't be deleted
			    {
					new
			        Float:x,
			        Float:y,
			        Float:z,
			        Float:r,
			        Float:dist = 50.0,
			        Float:tmpang,
			        Float:tmpx,
			        Float:tmpy,
			        Float:tmpz;

					FireShot[playerid] = 1;
					SetTimerEx("ShotFire", 1000, 0, "i", playerid);
					GetVehiclePos(vehicleid, x, y, z);
					GetVehicleZAngle(vehicleid, r);
					gRocketObj[playerid] = CreateObject(345, x, y, z, 0, 0, r);

					for(new i;i<MAX_PLAYERS;i++)
					{
					    if(i == playerid)continue;
					    if(IsPlayerInRangeOfPoint(i, 50.0, x, y, z))
					    {
					        GetPlayerPos(i, tmpx, tmpy, tmpz);

					        tmpang = (90-atan2(tmpy-y, tmpx-x));
					        if(tmpang < 0)tmpang = 360.0+tmpang;
					        tmpang = 360.0 - tmpang;

				            if( floatabs(tmpang-r) < 5.0)
				            {
				                dist = GetPlayerDistanceFromPoint(i, x, y, z);
				            }
					    }
					}
					MoveObject(gRocketObj[playerid],x + (dist * floatsin(-r, degrees)),y + (dist * floatcos(-r, degrees)),z,100.0);                             // Nice and fast!
			    }
			}
		}
	}
Код:
forward ShotFire(playerid);
public ShotFire(playerid)
{
        FireShot[playerid] = 0;
        return 1;
}
Reply


Messages In This Thread
Help me :( . - by quochuy - 19.05.2015, 11:58
Re: Help me :( . - by quochuy - 19.05.2015, 15:57
Re: Help me :( . - by quochuy - 19.05.2015, 17:32
Re: Help me :( . - by azzerking - 19.05.2015, 18:30

Forum Jump:


Users browsing this thread: 2 Guest(s)