28.09.2010, 16:47
I just maded up this thing to prevent ppl jumping all the time (a bit from scratch and a bit modifying other's scripts)
If u jump more than 3 times in 4.5 seconds it plays a "tired" animation.... it works perfectly, but only if you are ID= 0, ot herwise it ALLWAYS forces the animation whenever you jump, and also the animation never stops...its like the playerdata is not changing for other players, only for player 1...Anyone could help? D=...ALso if this script get fixed would be useful for anyone =O
public OnFilterScriptInit()
{
SetTimer("saltitos",4500,1);
}
enum PlayerData
{
saltos,
}
forward saltitos(playerid);
public saltitos(playerid)
{
if (PlayerInfo[playerid][saltos] <= 0)
{
ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
}
PlayerInfo[playerid][saltos] = 2;
return 1;
}
public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][saltos] = 2;
IsKeyJustDown(key, newkeys, oldkeys)
{
if((newkeys & key) && !(oldkeys & key)) return 1;
return 0;
}
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
if(IsKeyJustDown(KEY_JUMP,newkeys,oldkeys))
{
if(PlayerInfo[playerid][saltos] >= 0)
{
PlayerInfo[playerid][saltos] = PlayerInfo[playerid][saltos] -1;
}
if( PlayerInfo[playerid][saltos] <= 0)
{
ApplyAnimation(playerid,"PED","IDLE_tired",4.0,1,0 ,0,1,5500);
}
}
}
If u jump more than 3 times in 4.5 seconds it plays a "tired" animation.... it works perfectly, but only if you are ID= 0, ot herwise it ALLWAYS forces the animation whenever you jump, and also the animation never stops...its like the playerdata is not changing for other players, only for player 1...Anyone could help? D=...ALso if this script get fixed would be useful for anyone =O
public OnFilterScriptInit()
{
SetTimer("saltitos",4500,1);
}
enum PlayerData
{
saltos,
}
forward saltitos(playerid);
public saltitos(playerid)
{
if (PlayerInfo[playerid][saltos] <= 0)
{
ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
}
PlayerInfo[playerid][saltos] = 2;
return 1;
}
public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][saltos] = 2;
IsKeyJustDown(key, newkeys, oldkeys)
{
if((newkeys & key) && !(oldkeys & key)) return 1;
return 0;
}
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
if(IsKeyJustDown(KEY_JUMP,newkeys,oldkeys))
{
if(PlayerInfo[playerid][saltos] >= 0)
{
PlayerInfo[playerid][saltos] = PlayerInfo[playerid][saltos] -1;
}
if( PlayerInfo[playerid][saltos] <= 0)
{
ApplyAnimation(playerid,"PED","IDLE_tired",4.0,1,0 ,0,1,5500);
}
}
}