Need help with Spawn campers/Knife animation/Score 0 bug Thanks
#1

I have a COD war samp server but I have a 3 little problems I hope you can assist me with.

1. The opposing team has realised if you sit in the passenger seat of a car or bike they can't be killed is there anyway of solving this?

2. If the same team does the knife animation on their own team it leaves them left on the ground and seeing as you can't kill your own team mate you are stuck laying on the ground until re-spawned

3. Some players have come back with score 0 not sure why

If you can help with any issues above please number the solution as shown above

Thanks
Reply
#2

1.st Check player seat and set they health to max.
2nd Check player team... And you could use check weapon etc.
3rd. Save system needed. (register and login system)
Reply
#3

1. I've two ways.

First:
pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate )
{
    if( newstate == PLAYER_STATE_PASSENGER ) SetPlayerArmedWeapon( playerid, 0 );
    return 1;
}
Second:
pawn Код:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
    if( newkeys & KEY_CROUCH && GetPlayerState( playerid ) == PLAYER_STATE_PASSENGER )
    {
        new
            vehicleid = GetPlayerVehicleID( playerid ),
            seat = GetPlayerVehicleSeat( playerid )
        ;
        RemovePlayerFromVehicle( playerid );
        PutPlayerInVehicle( playerid, vehicleid, seat );
    }
    return 1;
}
2. Actually team mates can kill players from their team with a knife; however, the player is not synced and as a result, it will be on the floor. That might be useful, you need to modify it though (I just gave you an example, you need to check if any player is in xy of the player (with the knife) and check if they're both at the same team etc).

pawn Код:
public OnPlayerUpdate( playerid )
{
    if( GetPlayerAnimationIndex( playerid ) )
    {
        new
            animlib[ 32 ],
            animname[ 32 ]
        ;
        GetAnimationName( GetPlayerAnimationIndex( playerid ), animlib, 32, animname, 32 );
        if( !strcmp( animlib, "KNIFE", true ) && !strcmp( animname, "KILL_PARTIAL", true ) )
        {
            ClearAnimations( playerid );
        }
    }
    return 1;
}
Or you can re-set player's position instead of clearing animations.

3. Do you save their statistics when they disconnect?

EDIT: Pottus, he means that when you enter as passenger in nrg-500 (or some other bike), it takes no damage.
Reply
#4

1.) You can be killed as passenger
2.) This is quite possible but it requires several things

- Detect when a player presses aim+fire with a knife
- Detect when a player is doing the knife death animation
- If player is doing knife death animation check for other players around that player if there is a player of the same team when is the last time they pressed aim+fire with the knife? If less than say 2 seconds we have a team knife

3.) No code no idea.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)