SA-MP Forums Archive
Freeze Car - 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)
+--- Thread: Freeze Car (/showthread.php?tid=339215)



Freeze Car - Serifukas - 02.05.2012

Hello.

I want to create simple car freezing system with command

Like this :

Code:
if(strcmp(cmdtext, "/freezecar", true)==0)
{
Freeze(vehicleid);
return 1;
}
It is possible?

If it possible then can someone explain little bit, how can I create command like this.

Thanks For Attention.


Re: Freeze Car - FalconX - 02.05.2012

Quote:
Originally Posted by Serifukas
View Post
Hello.

I want to create simple car freezing system with command

Like this :

Code:
if(strcmp(cmdtext, "/freezecar", true)==0)
{
Freeze(vehicleid);
return 1;
}
It is possible?

If it possible then can someone explain little bit, how can I create command like this.

Thanks For Attention.
There might be alternate ways but this is how you can do (just an example):-

pawn Code:
new frozecar[MAX_VEHICLES]; // on top

frozecar[vehicleid] = 0; //OnVehicleSpawn lol

CMD:freezecar(playerid, params[])
{
    if ( !IsPlayerInAnyVehicle( playerid ) )return SendClientMessage( playerid, -1, "You are not in any vehicle." );
        new vid = GetPlayerVehicleID( playerid ), engine,lights,alarm,doors,bonnet,boot,objective;
    if(frozecar[vid] == 0)
    {
        SendClientMessage(playerid, -1, "SERVER: The engine is now started.");
        frozecar[vid] = 1;
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vid,1,lights,alarm,doors,bonnet,boot,objective); // the second one is engine, 1 is on and 0 is off so you can do like this.
    }
    else
    {
        SendClientMessage(playerid, -1, "SERVER: The engine is now turned off.");
        frozecar[vid] = 0;
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vid,0,lights,alarm,doors,bonnet,boot,objective); // the second one is engine, 1 is on and 0 is off so you can do like this.
    }
    return 1;
}
Original link: https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
-FalconX


Re: Freeze Car - Serifukas - 03.05.2012

Quote:
Originally Posted by FalconX
View Post
There might be alternate ways but this is how you can do (just an example):-

pawn Code:
new frozecar[MAX_VEHICLES]; // on top

frozecar[vehicleid] = 0; //OnVehicleSpawn lol

CMD:freezecar(playerid, params[])
{
    if ( !IsPlayerInAnyVehicle( playerid ) )return SendClientMessage( playerid, -1, "You are not in any vehicle." );
        new vid = GetPlayerVehicleID( playerid ), engine,lights,alarm,doors,bonnet,boot,objective;
    if(frozecar[vid] == 0)
    {
        SendClientMessage(playerid, -1, "SERVER: The engine is now started.");
        frozecar[vid] = 1;
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vid,1,lights,alarm,doors,bonnet,boot,objective); // the second one is engine, 1 is on and 0 is off so you can do like this.
    }
    else
    {
        SendClientMessage(playerid, -1, "SERVER: The engine is now turned off.");
        frozecar[vid] = 0;
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vid,0,lights,alarm,doors,bonnet,boot,objective); // the second one is engine, 1 is on and 0 is off so you can do like this.
    }
    return 1;
}
Original link: https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
-FalconX
I know this one there is engine starting and turning off script.

But i need frozen car then player leave it, and try to push the car then the car are standing with no driver,
that car stand in same position there i left her.