SA-MP Forums Archive
[HELP]Lock Always. - 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: [HELP]Lock Always. (/showthread.php?tid=112481)



[HELP]Lock Always. - Austin_Lynn - 08.12.2009

I want this vehicle to be locked, at all times so players can not enter it.
This is the code
Код:
SetVehicleParamsForPlayer(170,playerid,0,1);
under,
OnPlayerConnect


Re: [HELP]Lock Always. - 00aaaa00 - 08.12.2009

Код:
forward LockVehicle(vehicleid);

In ongamemodeinit   
SetTimer("LockVehicle",1000,1);

public LockVehicle(vehicleid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
SetVehicleParamsForPlayer(170,i,0,1);
}
}



Re: [HELP]Lock Always. - Danny_Costelo - 08.12.2009

Quote:
Originally Posted by 00aaaa00
[source]forward LockVehicle(vehicleid);

In ongamemodeinit
SetTimer("LockVehicle",1000,1);

public LockVehicle(vehicleid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
SetVehicleParamsForPlayer(170,i,0,1);
}
}
[/source]
That's the worst way ever to do it, and it won't work.

You can call this under OnPlayerConnect

pawn Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
    for(new j; j < MAX_PLAYERS; j++)
    {
        CarLocked[GetPlayerVehicleID(i)] = 0;
        SetVehicleParamsForPlayer(i, j, 0, 0);
    }
}
Than add this under OnVehicleStreamIn
pawn Код:
SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, CarLocked[vehicleid]);



Re: [HELP]Lock Always. - Austin_Lynn - 08.12.2009

Код:
C:\Documents and Settings\kareem\Desktop\0.3 script\gamemodes\rp.pwn(4698) : error 017: undefined symbol "CarLocked"
C:\Documents and Settings\kareem\Desktop\0.3 script\gamemodes\rp.pwn(4698) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\kareem\Desktop\0.3 script\gamemodes\rp.pwn(4698) : error 029: invalid expression, assumed zero
C:\Documents and Settings\kareem\Desktop\0.3 script\gamemodes\rp.pwn(4698) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: [HELP]Lock Always. - Danny_Costelo - 08.12.2009

pawn Код:
new CarLocked[MAX_VEHICLES] = 1;
Add this to the top. 1 for locked, 0 for unlocked.


Re: [HELP]Lock Always. - Austin_Lynn - 08.12.2009

Thanks (:


Re: [HELP]Lock Always. - Austin_Lynn - 08.12.2009

I added all that, and I can still enter the vehicle...


Re: [HELP]Lock Always. - Sew_Sumi - 08.12.2009

For gods sakes, Has NO-ONE read the example offered about OnVehicleStreamIn and the new way of making a vehicle LOCK?



Under OnVehicleStreamIn is where it should set the params...

and you need to remove the timer... Using OnvehicleStreamIn would be better.


Re: [HELP]Lock Always. - Austin_Lynn - 08.12.2009

@ Sew
Is that not what kylla did?
I did what Kylla said, and wasn't locked