16.04.2012, 11:17
Hello
I saw many players asking how to clear animations just by pressing " Fire " or other keys
I decided to make a tut about this.
1. Defining when player will use anim.
2. Making Commands
If you are using strcmp:
if you are using zcmd
3. Clearing animation
Done.
If you will find errors please PM me,but don't post bad comments,its one of my first tutorials![Smiley](images/smilies/smile.png)
If you will have any problems PM me
I saw many players asking how to clear animations just by pressing " Fire " or other keys
I decided to make a tut about this.
1. Defining when player will use anim.
pawn Код:
// At the top of your script
new Anim[MAX_PLAYERS]; // You need to define this,to be able to clear animations by pressing any keys
public OnPlayerConnect(playerid)
{
Anim[playerid] =0;
return 1;
}
public OnPlayerSpawn(playerid) // When player will spawn he won't be able to clear animations
{
Anim[playerid] =0;
return 1;
}
public OnPlayerSpawn(playerid) // When player will die will clear animations and will make player to not be able to clear anims.
{
ClearAnimations(playerid); // Clearing Animations
Anim[playerid] =0; // Setting varbiable to not be able to clear anims
return 1;
}
public OnPlayerDeath(playerid, killerid, reason) // When player will die will clear animations and will make player to not be able to clear anims like at ' OnPlayerSpawn '.
{
ClearAnimations(playerid); // Clearing Animations
Anim[playerid] =0; // Setting varbiable to not be able to clear anims
return 1;
}
If you are using strcmp:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/plantbomb", cmdtext, true, 10) == 0)
{
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0); // Applying ' Planting Bomb ' Animation on player
Anim[playerid] =1; // Add this to make player to be able to clear animations.
//If you will set Anim[playerid] To 1 [ Player will be able to clear them ] but if you will set Anim[playerid] =0 [ Player will not be able to clear them]
SendClientMessage(playerid,0x0080C0C8,"Press LMB to clear animation"); // Sends client message that he is able to clear animations by pressing LMB
return 1;
}
return 0;
}
pawn Код:
CMD:plantbomb(playerid,params[])
{
#pragma unused params
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0); // Applying ' Planting Bomb ' Animation on player
//Anim[playerid] =1; // Add this to make player to be able to clear animations.
//If you will set Anim[playerid] To 1 [ Player will be able to clear them ] but if you will set Anim[playerid] =0 [ Player will not be able to clear them]
SendClientMessage(playerid,0x0080C0C8,"Press LMB to clear animation"); // Sends client message that he is able to clear animations by pressing LMB
return 1;
}
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_FIRE && Anim[playerid] == 1) // Checks if player is pressing LMB[Fire] & can clear anim
{
ClearAnimations(playerid); // Clearing animations
Anim[playerid] =0; // Player won't be able to clear animations
SendClientMessage(playerid,0x00A3F0C8,"Animation Cleared"); // Sends client message to player that he cleared anim
}
return 1;
}
If you will find errors please PM me,but don't post bad comments,its one of my first tutorials
![Smiley](images/smilies/smile.png)
If you will have any problems PM me