Freezing a player in place during an animation.
#1

I have encountered a problem where if a played dies on my server, he gets an animation applied to him, but he can still bug into vehicles using F and G. I also want him to take damage while he lies on the floor. Any ideas?
Reply
#2

Have you tried to Toggle the player with the actual function? Not sure if that will solve anything but worth a try.

Another idea would be to set up an array:
pawn Код:
//above in the script:
new freezedPlayer[MAX_PLAYERS];

//when freezing a player, do without quotation marks: "freezedPlayer[targetID]*= 1;"

//when unfreezing a player, turn it back to 0

//somewhere else using a task/timer to perform a checkup if player is freezed and in a car:
task FreezedPlayerEscape[1000]() // formula: "task nameOfTimer[interval in milliseconds](any variable passed along?)
{
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
        if((freezedPlayer[i] == 1) && (IsPlayerInAnyVehicle(i))) //if player is freezer and if player is in vehicle
        {
             RemovePlayerFromVehicle(i);
             //freeze the player again and make the same animation here as well
        }
    }
}
Just an idea. And if commenting: "Why using an int array and not boolean?" Because with this array you maybe want to have different kinds of freezing options: number 2 meaning being cuffed, 3 meaning to that you hit a wall with your car. Both of these can collide with each other if used as only true or false options. If you understand what I mean. ^^ And yes this might not be the most optimal solution! :P

EDIT: Almost forgot to put this: https://sampforum.blast.hk/showthread.php?tid=182948 if you want more information about constant going timers.
Reply
#3

Hmm, you could do something like
Код:
SetPlayerPos(playerid, 0, 0, 3, blah blah);
To set the player away from the death scene to the middle of the map.
Or, you could change the virtual world of the player.
Or x2, you could just TogglePlayerControllable to freeze him, that'd be the most logical one.

Hope I could help.
Reply
#4

Quote:
Originally Posted by Hansrutger
Посмотреть сообщение
Have you tried to Toggle the player with the actual function? Not sure if that will solve anything but worth a try.

Another idea would be to set up an array:
pawn Код:
//above in the script:
new freezedPlayer[MAX_PLAYERS];

//when freezing a player, do without quotation marks: "freezedPlayer[targetID]*= 1;"

//when unfreezing a player, turn it back to 0

//somewhere else using a task/timer to perform a checkup if player is freezed and in a car:
task FreezedPlayerEscape[1000]() // formula: "task nameOfTimer[interval in milliseconds](any variable passed along?)
{
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
        if((freezedPlayer[i] == 1) && (IsPlayerInAnyVehicle(i))) //if player is freezer and if player is in vehicle
        {
             RemovePlayerFromVehicle(i);
             //freeze the player again and make the same animation here as well
        }
    }
}
Just an idea. And if commenting: "Why using an int array and not boolean?" Because with this array you maybe want to have different kinds of freezing options: number 2 meaning being cuffed, 3 meaning to that you hit a wall with your car. Both of these can collide with each other if used as only true or false options. If you understand what I mean. ^^ And yes this might not be the most optimal solution! :P

EDIT: Almost forgot to put this: https://sampforum.blast.hk/showthread.php?tid=182948 if you want more information about constant going timers.
Thanks man, I fixed the problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)