15.07.2016, 18:09
Oy, it's me again, so today i've fiddled around with animations a bit and i've made a script that makes the player roll when landing after a fall.
I wanted to make the script a bit more fleshed out but nor zcmd nor OnPlayerCommandText were working.
The compiler gives me no errors, yet when i'm in the game and i try to perform a command i've written in the script, it will give me UNKNOWN COMMAND for some reason, even this won't work
I don't understand why, it doesn't really look like i've done anything wrong so i'm not sure what's happening here
I wanted to make the script a bit more fleshed out but nor zcmd nor OnPlayerCommandText were working.
The compiler gives me no errors, yet when i'm in the game and i try to perform a command i've written in the script, it will give me UNKNOWN COMMAND for some reason, even this won't work
Код:
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#if defined FILTERSCRIPT
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
#define KEY_AIM KEY_HANDBRAKE
new Crouching[MAX_PLAYERS];
new StealthKillSetup[MAX_PLAYERS];
new TargetID;
new
Float: health,
Float: ang,
Float: x,
Float: y,
Float: z;
public OnFilterScriptInit()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
}
#endif
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_FIRE))
{
if(StealthKillSetup[playerid] == 1)
{
ApplyAnimation(playerid, "PED", "GUN_BUTT_crouch", 4.1, 0, 0, 0, 0, 0, 0);
GetPlayerTargetPlayer(TargetID);
SetPlayerHealth(TargetID, 0);
}
}
if(HOLDING(KEY_JUMP))
{
GetPlayerVelocity(playerid, x, y, z);
SetPlayerVelocity(playerid, x, y, z + 0.1);
}
return 1;
}
CMD:COSOBUFFO(playerid, params[])
{
SendClientMessage(playerid, 0xFFFFFF, "X^D"); <-------- Doesn't work for some reason
return 1;
}
public OnPlayerUpdate(playerid)
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK)
{
Crouching[playerid] = 1;
}
if(Crouching[playerid] == 1 && GetPlayerWeapon(playerid == 0 ))
{
if(GetPlayerTargetPlayer(playerid) != INVALID_PLAYER_ID)
{
StealthKillSetup[playerid] = 1;
}
}
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
if(weaponid == 54)
{
ClearAnimations(playerid);
GetPlayerFacingAngle(playerid, ang);
SetPlayerFacingAngle(playerid, ang + 90);
ApplyAnimation(playerid, "ped", "CROUCH_Roll_R", 100, 0, 1, 1, 0, 0, 0);
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health + amount);
}
}

