SA-MP Forums Archive
Vehicle Ownership - 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: Vehicle Ownership (/showthread.php?tid=157297)



Vehicle Ownership - TKZ227 - 06.07.2010

I'm creating a vehicle ownership from scratch for my RP script, but I'm stuck. How am I supposed to spawn a "unique" vehicle, which is housecar and will allow the player to lock that car specifically if they own it?

Basically, I would like to know how to make a "IsInHouseCar" function, but I'm not sure how.


Re: Vehicle Ownership - ToPhrESH - 06.07.2010

Not sure how to do it for people who own it but here is some /lock and /unlock command.
pawn Код:
OnGameModeInit()
{
       CreateVehicle(blah, blah, blah, blah, blah, blah);
}

public OnPlayerCommandText (playerid, cmdtext[])
{
     if (strmp("/unlock", cmdtext, true, 10) == 0)
     {
     Unlockmycars(playerid);
     return 1;
     }
     if (strmp("/lock", cmdtext, true, 10) == 0)
     {
     Lockmycars(playerid);
     return 1;    
     }
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
SetVehicleParamsForPlayer(1, forplayerid 0, 1);
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
SetVehicleParamsForPlayer(1, forplayerid 0, 1);
}

Lockmycars(playerid)
{
SetVehicleParamsForPlayer(1, forplayerid 0, 1);
}

Unlockmycars(playerid)
{
SetVehicleParamsForPlayer(1, forplayerid 0, 0);
}
You might need to forward Unlockmycars and Lockmycars if there's an error


Re: Vehicle Ownership - TKZ227 - 06.07.2010

Well I understand how to lock cars, I just don't know how to tell if they are in their housecar or not.


Re: Vehicle Ownership - ToPhrESH - 06.07.2010

Well I would make areas and use

IsPlayerInArea and work from there..

But of course I may be wrong because I have never scripted or dealt with anything like this.