Garage help -
Squidle - 17.05.2011
Greetings, everyone.
I am very new to scripting in SAMP. This is also my first thread. I have read some tutorials, I understand the basics (somewhat) and have scripted a few easy things.
But, now I want to create some Garage "system". I want two variations.
The first one
What I want: You drive in your car and pick up a pickup. Then you're able to do something like /enter. If you're not on the pick up, you're unable to enter it.
I know how to create a pickup and make it into a variable. I also got the coordinates. But, I don't know how I could script it so you have to write /enter once you picked it up.
The pickup up:
pawn Code:
new GaragePickup;
public OnGameModeInit()
{
SetGameModeText("Blank Script");
AddPlayerClass(0, 1877.9052734375,-1737.6791992188,13.355146,180, 0, 0, 0, 0, 0, 0);
AddStaticVehicle(587, -1745.3572998047, 982.47320556641, 17.678091049194, 270, 38, 1);
AddStaticVehicle(587, 1886.4532470703, -1746.6672363281, 13.356875419617, 90, 38, 1);
GaragePickup = CreatePickup(3096,2,1866.1990966797,-1760.0908203125,13.546875,-1);
return 1;
}
I have no clue what to do next, so a little help please?
![Cheesy](images/smilies/biggrin.png)
Coordinates:
Code:
Playerspawn: 1877.9052734375,-1737.6791992188,13.355146,180
Where the player starts
Garage1: 1884.8843994141,-1760.4916992188,13.546875
Where the pickup is and the entrace of the garage.
InGarage: -1747.0718994141,987.37799072266,18.087209701538
Where you should be teleported to when you enter it. (Also you should be able to do /exit here as well.
The second
What I want: You can drive to this point and use /storev(ehicle) so the car despawn and you can spawn it back later.
There should be a pickup here as well and I want these commands available:
/checkv - Shows which vehicles are in the garage.
/storev - Explained above, this should store your car in the garage (despawn).
/getv - Spawns the vehicle again
If it's possible, could there be a limit of 3 vehicles in the garage?
The coordinate of this garage is:
Code:
Garage2: 1866.1990966797,-1760.0908203125,13.546875
Thanks a lot!
Re: Garage help -
Squidle - 18.05.2011
Ok, I found out that I should add if(IsPlayerInRangeOfPoint(playerid, range, x, y, z)).
But somewhat my commands do not work. Once I use /enter, I can't use /exit. Is the return the problem?
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/enter", cmdtext, true, 6) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 10, 1866.1990966797,-1760.0908203125,13.546875))
{
SetPlayerPos(playerid,-1747.0718994141,987.37799072266,18.087209701538);
return 1;
}
return 1;
}
if (strcmp("/exit", cmdtext, true, 5) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 10, -1747.0718994141, 987.37799072266, 18.087209701538))
{
SetPlayerPos(playerid,1866.1990966797,-1760.0908203125,13.546875);
return 1;
}
return 1;
}
return 1;
}