SA-MP Forums Archive
Need a script/code ! - 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: Need a script/code ! (/showthread.php?tid=204494)



Need a script/code ! - Michael@Belgium - 29.12.2010

Hello everyebody x)
It's just one question:

Can you make a code for you can't get out a car !
I don't know to make a code for that

Plz reply ^^


Re: Need a script/code ! - thimo - 29.12.2010

TogglePlayerControllable(playerid, 1);
~edit: this also makes not movable


Re: Need a script/code ! - Ash. - 29.12.2010

I think "not getting out the car" will be a bit hard. But you could do something like this i guess...

pawn Код:
//Untested
new IsDriverOf[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
     if(newstate == PLAYER_STATE_DRIVER)
     {
          IsDriverOf[playerid] = GetPlayerVehicleID(playerid);
     }
     if(oldstate == PLAYER_STATE_DRIVER)
     {
          PutPlayerInVehicle(playerid, IsDriverOf[playerid], 0);
     }
     return 1;
}



Re: Need a script/code ! - Michael@Belgium - 30.12.2010

Quote:
Originally Posted by funky1234
Посмотреть сообщение
I think "not getting out the car" will be a bit hard. But you could do something like this i guess...

pawn Код:
//Untested
new IsDriverOf[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
     if(newstate == PLAYER_STATE_DRIVER)
     {
          IsDriverOf[playerid] = GetPlayerVehicleID(playerid);
     }
     if(oldstate == PLAYER_STATE_DRIVER)
     {
          PutPlayerInVehicle(playerid, IsDriverOf[playerid], 0);
     }
     return 1;
}
Didn't work


Re: Need a script/code ! - blackwave - 30.12.2010

Just one I could think quickly:
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 0;
}



Re: Need a script/code ! - Haydz - 30.12.2010

Quote:
Originally Posted by thimo
Посмотреть сообщение
TogglePlayerControllable(playerid, 1);
~edit: this also makes not movable
Pretty sure this would work, have you tryed it?


Re: Need a script/code ! - Michael@Belgium - 30.12.2010

Quote:
Originally Posted by thimo
Посмотреть сообщение
TogglePlayerControllable(playerid, 1);
~edit: this also makes not movable
If i do that:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    TogglePlayerControllable(playerid, 0);
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	TogglePlayerControllable(playerid, 1);
	return 1;
}
I can go in my car but i can't drive xd


Re: Need a script/code ! - DarrenReeder - 30.12.2010

TogglePlayerControllable(playerid, 0);
TogglePlayerControllable(playerid, 1);

OnPlayerExitVehicle??