SA-MP Forums Archive
Disable animations in vehicles - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Disable animations in vehicles (/showthread.php?tid=161363)



Disable animations in vehicles - RedFusion - 19.07.2010

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?


Re: Disable animations in vehicles - Jay. - 19.07.2010

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;
    }



Re: Disable animations in vehicles - [XST]O_x - 19.07.2010

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.


Re: Disable animations in vehicles - RedFusion - 19.07.2010

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


Re: Disable animations in vehicles - [XST]O_x - 19.07.2010

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;
    }



Re: Disable animations in vehicles - RedFusion - 19.07.2010

Thanks for the help.
Much appreciated.


Re: Disable animations in vehicles - Kar - 19.07.2010

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;
}



Re: Disable animations in vehicles - RedFusion - 19.07.2010

Okay thanks


Re: Disable animations in vehicles - RedFusion - 19.07.2010

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


Re: Disable animations in vehicles - Kar - 19.07.2010

xD sorry i forgot to take out the !