Help me :( . -
Код:
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!
}
}
}
}
Re: Help me :( . -
help me . Please
Re: Help me :( . -
Re: Help me :( . -
Do you want want to increment the value? if so instead of setting it to 1 do FireShot++;
doing ++ on the end of a integer value will add 1 to it.
or are you saying after resetting the value its still remains at 1? Even though you set it to 0?