#include <a_samp> #include "a_players" #include "a_objects" #if defined filterscripts public OnFilterScriptInit() { return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("bombaci\n"); } #endif public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys == KEY_NO) { switch(Vehicle[vehicleid]) { case 1: 460; } new Float:VehicleRotX, Float:VehicleRotY, Float:VehicleRotZ; GetPlayerPos(playerid, x, y, z); if(VehicleRotX == VehicleRotY) new torpedo = CreateObject(3790, x, y, z, rX, rY, rZ, DrawDistance) { MoveObject(torpedo, x + 15, y + 15, z, 250.0, RotX, RotY, RotZ); DestroyObject(torpedo); } else if(VehicleRotX = 5.0 && VehicleRotY = 0.0) { MoveObject(torpedo, x + 15, y, z, 250.0, RotX, RotY, RotZ); DestroyObject(torpedo); } else if(VehicleRotX = 0.0 && VehicleRotY = 5.0) { MoveObject(torpedo, x + 15, y, z, 250.0, RotX, RotY, RotZ); DestroyObject(torpedo); } if(DestroyObject(torpedo)) { CreateExplosion(x, y, z, 7, 15); } return 1; }
C:\SAMP\filterscripts\torpedo.pwn(34) : error 017: undefined symbol "Vehicle" C:\SAMP\filterscripts\torpedo.pwn(34) : error 029: invalid expression, assumed zero C:\SAMP\filterscripts\torpedo.pwn(34) : error 029: invalid expression, assumed zero C:\SAMP\filterscripts\torpedo.pwn(34) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
new Vehicle[MAX_VEHICLES];
switch(Vehicle[vehicleid])
{
case 1: 460;
}
new vehicleid = GetPlayerVehicleID(playerid); //Storing Vehicle ID of Player in "vehicleid"
new model = GetVehicleModel(vehicleid); //Storing Vehicle Model of Player in "vehicleid"
if(modelid == 460) //if vehicle model is skimmer plane continue your code here
{
}
new Float:VehicleRotX, Float:VehicleRotY, Float:VehicleRotZ;
stock GetVehicleRotation(vehicleid,&Float:x,&Float:y,&Float:z) //Credits: Stepashka
{
new Float:quat_w,Float:quat_x,Float:quat_y,Float:quat_z;
GetVehicleRotationQuat(vehicleid,quat_w,quat_x,quat_y,quat_z);
x = atan2(2*((quat_x*quat_y)+(quat_w+quat_z)),(quat_w*quat_w)+(quat_x*quat_x)-(quat_y*quat_y)-(quat_z*quat_z));
y = atan2(2*((quat_y*quat_z)+(quat_w*quat_x)),(quat_w*quat_w)-(quat_x*quat_x)-(quat_y*quat_y)+(quat_z*quat_z));
z = asin(-2*((quat_x*quat_z)+(quat_w*quat_y)));
return 1;
}
new Float:VehicleRotX, Float:VehicleRotY, Float:VehicleRotZ;
GetVehicleRotation(vehicleid, VehicleRotX, VehicleRotY, VehicleRotZ);
GetPlayerPos(playerid, x, y, z);
new Float:VehX, Float:VehY, Float:VehZ;
GetVehiclePos(vehicleid, VehX, VehY, VehZ); //Storing vehicle position inside Vehx, vehy and vehz
if(VehicleRotX == VehicleRotY)
new torpedo = CreateObject(3790, x, y, z, rX, rY, rZ, DrawDistance)
{
MoveObject(torpedo, x + 15, y + 15, z, 250.0, RotX, RotY, RotZ);
DestroyObject(torpedo);
}
else
if(VehicleRotX = 5.0 && VehicleRotY = 0.0)
{
MoveObject(torpedo, x + 15, y, z, 250.0, RotX, RotY, RotZ);
DestroyObject(torpedo);
}
else
if(VehicleRotX = 0.0 && VehicleRotY = 5.0)
{
MoveObject(torpedo, x + 15, y, z, 250.0, RotX, RotY, RotZ);
DestroyObject(torpedo);
}
if(DestroyObject(torpedo))
{
CreateExplosion(x, y, z, 7, 15);
}
return 1;
}
if(VehicleRotX == VehicleRotY) //when x and y rotation are same
{
new objectid = CreateObject(3790, VehX, VehY, VehZ, VehicleRotX, VehicleRotY, VehicleRotZ); //creating object and storing id in objectid so we can destroy it later
MoveObject(objectid, VehX + 15.0,, VehY + 15.0, VehZ, 250.0, VehicleRotX, VehicleRotY, VehicleRotZ); //moving object we just created
SetTimerEx("Missile", 5000, false, "i", objectid); //Starting a timer so we can delete the object and create after 5 seconds, keep in mind timer uses millisecond, so 5000 = 5 seconds
}
else if(VehicleRotX = 5.0 && VehicleRotY = 0.0) //when rotation x is 5.0 and y rotation is 0.0
{
new objectid = CreateObject(3790, VehX, VehY, VehZ, VehicleRotX, VehicleRotY, VehicleRotZ); //creating object and storing id in objectid so we can destroy it later
MoveObject(objectid, VehX + 15, VehY, VehZ, 250.0, VehicleRotX, VehicleRotY, VehicleRotZ); //moving object we just created
SetTimerEx("Missile", 5000, false, "i", objectid); //Starting a timer so we can delete the object and create after 5 seconds, keep in mind timer uses millisecond, so 5000 = 5 seconds
}
else if(VehicleRotX = 0.0 && VehicleRotY = 5.0) //when rotation x is 0.0 and y rotation is 5.0
{
new objectid = CreateObject(3790, VehX, VehY, VehZ, VehicleRotX, VehicleRotY, VehicleRotZ); //creating object and storing id in objectid so we can destroy it later
MoveObject(objectid, VehX + 15, VehY, VehZ, 250.0, VehicleRotX, VehicleRotY, VehicleRotZ); //moving object we just created
SetTimerEx("Missile", 5000, false, "i", objectid); //Starting a timer so we can delete the object and create after 5 seconds, keep in mind timer uses millisecond, so 5000 = 5 seconds
}
forward Missile(objectid);
public Missile(objectid) //ok this is where we put what happens after 5 seconds
{
new Float:x, Float:y, Float:z; //creating float array
GetObjectPos(objectid, x, y, z); //getting objects position
CreateExplosion(x, y, z, 7, 10.0); //creating explosion on oject
DestroyObject(objectid); //destroying the object
}
#include <a_samp>
#include <a_players>
#include <a_objects>
#if defined filterscripts
public OnFilterScriptInit()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("bombaci\n");
}
#endif
stock GetVehicleRotation(vehicleid,&Float:x,&Float:y,&Float:z) //Credits: Stepashka
{
new Float:quat_w,Float:quat_x,Float:quat_y,Float:quat_z;
GetVehicleRotationQuat(vehicleid,quat_w,quat_x,quat_y,quat_z);
x = atan2(2*((quat_x*quat_y)+(quat_w+quat_z)),(quat_w*quat_w)+(quat_x*quat_x)-(quat_y*quat_y)-(quat_z*quat_z));
y = atan2(2*((quat_y*quat_z)+(quat_w*quat_x)),(quat_w*quat_w)-(quat_x*quat_x)-(quat_y*quat_y)+(quat_z*quat_z));
z = asin(-2*((quat_x*quat_z)+(quat_w*quat_y)));
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_NO) //when you press key n
{
new vehicleid = GetPlayerVehicleID(playerid); //Storing Vehicle ID of Player in "vehicleid"
new model = GetVehicleModel(vehicleid); //Storing Vehicle Model of Player in "vehicleid"
if(model == 460) //if vehicle model is skimmer plane continue your code here
{
new Float:VehicleRotX, Float:VehicleRotY, Float:VehicleRotZ; //Creating variables
GetVehicleRotation(vehicleid, VehicleRotX, VehicleRotY, VehicleRotZ); //storing rotation in the variables we just created
new Float:VehX, Float:VehY, Float:VehZ; //Creating variables
GetVehiclePos(vehicleid, VehX, VehY, VehZ); //Storing vehicle position inside Vehx, vehy and vehz
if(VehicleRotX == VehicleRotY) //when x and y rotation are same
{
new objectid = CreateObject(3790, VehX, VehY, VehZ, VehicleRotX, VehicleRotY, VehicleRotZ); //creating object and storing id in objectid so we can destroy it later
MoveObject(objectid, VehX + 15.0, VehY + 15.0, VehZ, 250.0, VehicleRotX, VehicleRotY, VehicleRotZ); //moving object we just created
SetTimerEx("Missile", 5000, false, "i", objectid); //Starting a timer so we can delete the object and create after 5 seconds, keep in mind timer uses millisecond, so 5000 = 5 seconds
}
else if(VehicleRotX == 5.0 && VehicleRotY == 0.0) //when rotation x is 5.0 and y rotation is 0.0
{
new objectid = CreateObject(3790, VehX, VehY, VehZ, VehicleRotX, VehicleRotY, VehicleRotZ); //creating object and storing id in objectid so we can destroy it later
MoveObject(objectid, VehX + 15.0, VehY, VehZ, 250.0, VehicleRotX, VehicleRotY, VehicleRotZ); //moving object we just created
SetTimerEx("Missile", 5000, false, "i", objectid); //Starting a timer so we can delete the object and create after 5 seconds, keep in mind timer uses millisecond, so 5000 = 5 seconds
}
else if(VehicleRotX == 0.0 && VehicleRotY == 5.0) //when rotation x is 0.0 and y rotation is 5.0
{
new objectid = CreateObject(3790, VehX, VehY, VehZ, VehicleRotX, VehicleRotY, VehicleRotZ); //creating object and storing id in objectid so we can destroy it later
MoveObject(objectid, VehX + 15.0, VehY, VehZ, 250.0, VehicleRotX, VehicleRotY, VehicleRotZ); //moving object we just created
SetTimerEx("Missile", 5000, false, "i", objectid); //Starting a timer so we can delete the object and create after 5 seconds, keep in mind timer uses millisecond, so 5000 = 5 seconds
}
}
}
return 1;
}
forward Missile(objectid);
public Missile(objectid) //ok this is where we put what happens after 5 seconds
{
new Float:x, Float:y, Float:z; //creating float array
GetObjectPos(objectid, x, y, z); //getting objects position
CreateExplosion(x, y, z, 7, 10.0); //creating explosion on oject
DestroyObject(objectid); //destroying the object
}
if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 460)return 1;
Thats because you are doing almost everything wrong, lets start from the beginning
pawn Код:
this is the correct way pawn Код:
pawn Код:
pawn Код:
pawn Код:
pawn Код:
pawn Код:
By your code i figured that you are creating missile system, so here is how you do it pawn Код:
and this is how your code should look like pawn Код:
didnt test but it should work |