28.08.2012, 11:51
Sorry, I was about to post my solution but SAMP forums decided to have a maintenance...
Here it is:
I also noticed you were trying to use vehicle == 422. I used to do this when I was new to scripting, this is probably where your script was screwing up. You need to use GetVehicleModel if you're trying to get the actual Model ID. Example: The Vehicle model for NRG is 522. The Vehicle model for Infernus is 411. However, vehicle model and vehicle ID are two different things. So in this case, you should have used if(GetVehicleModel(vehicleid) == 422)
Here it is:
pawn Код:
public OnFilterScriptInit() //Or OnGameModeInit() if you're using a gamemode
{
SetTimer("BobCheck", 1000, true);
return 1;
}
forward BobCheck();
public BobCheck()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
for(new v = 0; v < MAX_VEHICLES; v++)
{
if(GetVehicleModel(v) == 422)
{
if(UserStats[i][KeysBob] == 1) //If they have keys
{
SetVehicleParamsForPlayer(v, i, 0, 0); //Unlock Vehicle (Bobcat)
}
else
{
SetVehicleParamsForPlayer(v, i, 0, 1); //Lock Vehicle (Bobcat)
}
}
}
}
}
return 1;
}