Help About something important -
BigBaws - 14.12.2011
hello Folks i added a systeme but i dont know why it making me this bug check
CODE
Код:
else if(newkeys == KEY_SECONDARY_ATTACK)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(gEngine[playerid] == 0 && engineOn[newcar] == 0)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
else if(NoFuel[playerid] == 1)
{
TogglePlayerControllable(playerid, 1);
RemovePlayerFromVehicle(playerid);
NoFuel[playerid] = 0;
return 1;
}
}
}
return 1;
}
if (newkeys == KEY_FIRE && GetPlayerWeapon(playerid) == 41)
{
SetTimerEx("OnPlayerSpray",2000,0,"d",playerid);
}
return 0;
}
Screen
Re: Help About something important -
TheArcher - 14.12.2011
Because you return twice in the same declaration. Delete the " } " and return 1; above
if (newkeys == KEY_FIRE && GetPlayerWeapon(playerid) == 41)
AW: Help About something important -
BigETI - 14.12.2011
Try a bitwise check on the variable "keys" otherwise if you press multiple buttons, so the check will fail.
pawn Код:
if(keys & KEY_SECONDARY_ATTACK)
{
//...
}
Re : Help About something important -
BigBaws - 14.12.2011
Oh yea didnt saw it fixed The first bug but the 2snt one arnt fixed you Look the Code
stock PlayerToPoint(playerid,Float:radi, Float

x, Float

y, Float

z)
{
if(IsPlayerConnected(playerid))
{
new Float

, Float:y, Float:z;
new Float

x, Float

y, Float

z;
GetPlayerPos(playerid, ox, oy, oz);
x = (ox -px);
y = (oy -py);
z = (oz -pz);
if (((x < radi) && (x > -radi)) && ((y < radi) && (y > -radi)) && ((z < radi) && (z > -radi))) return 1;
}
return 0;
}
Bug Screen
Re: Help About something important -
TheArcher - 14.12.2011
PlayerToPlayer function is already called somewhere. It might be the same as you show us here. Just try to remove or comment " /* and */ " the function then re-compile.
AW: Help About something important -
BigETI - 14.12.2011
PlayerToPoint is already defined.
Check all of your forwards/publics
By the way there are already function for this check
pawn Код:
IsPlayerInRangeOfPoint(playerid, Float:range, Float:X, Float:Y, Float:Z)
or if you need the range especially
pawn Код:
GetPlayerDistanceFromPoint(playerid, Float:X, Float:Y, Float:Z)