Disable animations in vehicles
#1

I am working on an animation filterscript.
I want to disable the cmd /sit in vehicles for an example.

Here is my current code, and it doesn't work.

Код:
	if (strcmp("/sit", cmdtext, true, 10) == 0)
	{
		if(GetVehicleModel (0))
		{
		ApplyAnimation (playerid, "PED", "SEAT_IDLE",1,1,1,1,0,0);
		}
		return 1;
	}
What is wrong & how do i fix it?
Reply
#2

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
I am working on an animation filterscript.
I want to disable the cmd /sit in vehicles for an example.

Here is my current code, and it doesn't work.

Код:
	if (strcmp("/sit", cmdtext, true, 10) == 0)
	{
		if(GetVehicleModel((0);
		{
		ApplyAnimation (playerid, "PED", "SEAT_IDLE",1,1,1,1,0,0);
		}
		return 1;
	}
What is wrong & how do i fix it?
pawn Код:
if (strcmp("/sit", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel (playerid == 0)
        {
        ClearAnimations(playerid);
        }
        return 1;
    }
Reply
#3

pawn Код:
if (strcmp("/sit", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid))
        {
        ApplyAnimation (playerid, "PED", "SEAT_IDLE",1,1,1,1,0,0);
        }
        return 1;
    }
The '!' makes sure that the player is not inside any vehicle,and after it checked he's not,it will apply the function.
Reply
#4

Thanks!
How do i add
Код:
SendClientMessage (playerid,0xFF6347AA,"Get out of the vehicle first.");
if the player is in a vehicle
Reply
#5

pawn Код:
if (strcmp("/sit", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid))
        {
        ApplyAnimation (playerid, "PED", "SEAT_IDLE",1,1,1,1,0,0);
        }
        else
        {
            SendClientMessage (playerid,0xFF6347AA,"Get out of the vehicle first.");
        }
        return 1;
    }
Reply
#6

Thanks for the help.
Much appreciated.
Reply
#7

optimized

pawn Код:
if (strcmp("/sit", cmdtext, true, 10) == 0)
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage (playerid,0xFF6347AA,"Get out of the vehicle first.");
    else
    {
        ApplyAnimation (playerid, "PED", "SEAT_IDLE",1,1,1,1,0,0);
    }
    return 1;
}
Reply
#8

Okay thanks
Reply
#9

Quote:
Originally Posted by Kar
Посмотреть сообщение
optimized

pawn Код:
if (strcmp("/sit", cmdtext, true, 10) == 0)
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage (playerid,0xFF6347AA,"Get out of the vehicle first.");
    else
    {
        ApplyAnimation (playerid, "PED", "SEAT_IDLE",1,1,1,1,0,0);
    }
    return 1;
}
That thing just reversed it all.
Now when i want to do an animation on foot it says i have to step out of my car and nothing more happens.
But when i'm in a car the animation starts on the command.

w/e i fixed it myself.
Swapped what's after return with what's after else
Reply
#10

xD sorry i forgot to take out the !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)