[HELP]Lock Always.
#1

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
Reply
#2

Код:
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);
}
}
Reply
#3

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]);
Reply
#4

Код:
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.
Reply
#5

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

Thanks (:
Reply
#7

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

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.
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)