if (PRESSED(KEY_FIRE))
{
AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
}
if(newkeys & KEY_SUBMISSION)
{
if (IsPlayerInAnyVehicle(playerid))
{
if((GetPlayerVehicleID(playerid) == 520) || (GetPlayerVehicleID(playerid) == 425) || (GetPlayerVehicleID(playerid) == 464)) {
return 1;
}
else {
new Float:vx, Float:vy, Float:vz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx*2,vy*2 ,vz*2);
}
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SECONDARY_ATTACK)
{
if(!IsPlayerInAnyVehicle(playerid))
{
new Float:x, Float:y, Float:z, vehicle;
GetPlayerPos(playerid, x, y, z);
GetVehicleWithinDistance(playerid, x, y, z, 20.0, vehicle);
if(IsVehicleRc(vehicle))
{
PutPlayerInVehicle(playerid, vehicle, 0);
}
}
else {
new vehicleID = GetPlayerVehicleID(playerid);
if(IsVehicleRc(vehicleID) || GetVehicleModel(vehicleID) == RC_CAM){
if(GetVehicleModel(vehicleID) != D_TRAM){
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x+0.5, y, z+1.0);
}
}
}
}
if(!gPlayerUsingLoopingAnim[playerid]) return;
if(IsKeyJustDown(KEY_SECONDARY_ATTACK,newkeys,oldkeys))
{
StopLoopingAnim(playerid);
TextDrawHideForPlayer(playerid,txtAnimHelper);
}
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SECONDARY_ATTACK)
{
if(!IsPlayerInAnyVehicle(playerid))
{
new Float:x, Float:y, Float:z, vehicle;
GetPlayerPos(playerid, x, y, z);
GetVehicleWithinDistance(playerid, x, y, z, 20.0, vehicle);
if(IsVehicleRc(vehicle))
{
PutPlayerInVehicle(playerid, vehicle, 0);
}
}
else {
new vehicleID = GetPlayerVehicleID(playerid);
if(IsVehicleRc(vehicleID) || GetVehicleModel(vehicleID) == RC_CAM){
if(GetVehicleModel(vehicleID) != D_TRAM){
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x+0.5, y, z+1.0);
}
}
}
}
if(!gPlayerUsingLoopingAnim[playerid]) return;
if(IsKeyJustDown(KEY_SECONDARY_ATTACK,newkeys,oldkeys))
{
StopLoopingAnim(playerid);
TextDrawHideForPlayer(playerid,txtAnimHelper);
}
if (PRESSED(KEY_FIRE))
{
AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
}
if(newkeys & KEY_SUBMISSION)
{
if (IsPlayerInAnyVehicle(playerid))
{
if((GetPlayerVehicleID(playerid) == 520) || (GetPlayerVehicleID(playerid) == 425) || (GetPlayerVehicleID(playerid) == 464)) {
return 1;
}
else {
new Float:vx, Float:vy, Float:vz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx*2,vy*2 ,vz*2);
}
}
}
return 1;
}
pawn Код:
|
(939) : warning 209: function "OnPlayerKeyStateChange" should return a value (954) : error 078: function uses both "return" and "return <value>" (963) : error 078: function uses both "return" and "return <value>"
if(!gPlayerUsingLoopingAnim[playerid]) return; if(IsKeyJustDown(KEY_SECONDARY_ATTACK,newkeys,oldkeys)) { StopLoopingAnim(playerid); TextDrawHideForPlayer(playerid,txtAnimHelper); } if (PRESSED(KEY_FIRE)) { AddVehicleComponent(GetPlayerVehicleID(playerid),1010); } if(newkeys & KEY_SUBMISSION) { if (IsPlayerInAnyVehicle(playerid)) { if((GetPlayerVehicleID(playerid) == 520) || (GetPlayerVehicleID(playerid) == 425) || (GetPlayerVehicleID(playerid) == 464)) { return 1; } else { new Float:vx, Float:vy, Float:vz; GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz); SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx*2,vy*2 ,vz*2); } } } return 1; }
that's because you return; and return 1; in the same function.
this is a sa-mp callback, therefore you shouldn't be returning without either 1 or 0 anyway. |
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SECONDARY_ATTACK)
{
if(!IsPlayerInAnyVehicle(playerid))
{
new Float:x, Float:y, Float:z, vehicle;
GetPlayerPos(playerid, x, y, z);
GetVehicleWithinDistance(playerid, x, y, z, 20.0, vehicle);
if(IsVehicleRc(vehicle))
{
PutPlayerInVehicle(playerid, vehicle, 0);
}
}
else
{
new vehicleID = GetPlayerVehicleID(playerid);
if(IsVehicleRc(vehicleID) || GetVehicleModel(vehicleID) == RC_CAM)
{
if(GetVehicleModel(vehicleID) != D_TRAM)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x+0.5, y, z+1.0);
}
}
}
}
if(!gPlayerUsingLoopingAnim[playerid]) return 1;
if(IsKeyJustDown(KEY_SECONDARY_ATTACK,newkeys,oldkeys))
{
StopLoopingAnim(playerid);
TextDrawHideForPlayer(playerid,txtAnimHelper);
}
if(PRESSED(KEY_FIRE)) AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
if(newkeys & KEY_SUBMISSION)
{
if(IsPlayerInAnyVehicle(playerid))
{
if((GetPlayerVehicleID(playerid) == 520) || (GetPlayerVehicleID(playerid) == 425) || (GetPlayerVehicleID(playerid) == 464)) return 1;
else
{
new Float:vx, Float:vy, Float:vz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx*2,vy*2 ,vz*2);
}
}
}
return 1;
}
Try This:
pawn Код:
|
#define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))