26.05.2014, 22:37
Hi- I made a small script where when you shoot a spot on the ground, or even shoot a player.. It's supposed to TP you to the spot you shot, OR 'slap' the player you shot into the air.
The problem is, the fX fY and fZ are returning 0.0 as a float value, even though I'm shooting something.
I even set up a little script to show me what I'm shooting, and it still doesn't return a float variable for any of the float values.
You can see here, after reviewing the small little script I set up- I shot the ground many times, and it's still returning 0.0.
The problem is, the fX fY and fZ are returning 0.0 as a float value, even though I'm shooting something.
I even set up a little script to show me what I'm shooting, and it still doesn't return a float variable for any of the float values.
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new Float:origin[3];
new Float:hitloc[3];
//GetPlayerLastShotVectors(playerid, origin[0], origin[1], origin[2], hitloc[0], hitloc[1], hitloc[2]);
if(RIPrifle[playerid] != 0)
{
if(weaponid == 33)
{
if(hittype == BULLET_HIT_TYPE_NONE)
{
if(RIPrifle[playerid] == 1)
{
SetPlayerPos(playerid, fX, fY, fZ);
SCM(playerid, COLOR_LIGHTRED, "You shot the RIP rifle and teleported! HACKSS!!!!!!!!");
}
if(RIPrifle[playerid] == 2)
{
CreateExplosion(fX, fY, fZ, 0, 10.0);
}
}
if(hittype == BULLET_HIT_TYPE_PLAYER)
{
if(hitid != INVALID_PLAYER_ID)
{
if(RIPrifle[playerid] == 3)
{
format(msg,sizeof(msg),"* The RIP Rifle bullet flies towards %s, and hits them in the ass.", GetName(hitid));
SCMALL(COLOR_PURPLE, msg);
Kick(hitid);
}
if(RIPrifle[playerid] == 6)
{
SetPlayerPos(hitid, fX, fY, fZ+75);
}
}
}
if(hittype == BULLET_HIT_TYPE_VEHICLE)
{
if(hitid != INVALID_VEHICLE_ID)
{
if(RIPrifle[playerid] == 5)
{
new col1 = randomEx(1, 157);
new col2 = randomEx(1, 157);
ChangeVehicleColor(hitid, col1, col2);
}
if(RIPrifle[playerid] == 6)
{
SetVehicleVelocity(hitid, 100.0, 0.0, 0.0);
}
}
}
}
}
format(msg, sizeof(msg), "Weapon %i fired. hittype: %i hitid: %i pos: %f, %f, %f", weaponid, hittype, hitid, fX, fY, fZ);
DebugMSG(playerid, msg);
return 1;
}

