car shop/dealer -
security - 24.02.2010
I'm trying to make a carshop/dealer, i want so that if you do /prices you get a list of the availble cars from that carshop in the chatbox.
When you do /buy you got a menu with the kind vehicle like, bikes, normal cars, sport cars. But how to make that command so that it only can be used at a zone ( this is what i have for the coordinates etc:
Код:
// Above OnGameModeInit:
new carshop;
public OnGameModeInit()
{
carshop = GangZoneCreate(-2000,689, 262,6848, -1915,71, 329,7492);
return 1;
}
public OnPlayerSpawn(playerid)
{
GangZoneShowForPlayer(playerid, carshop, 0x00000096);
return 1;
}
Re: car shop/dealer -
VonLeeuwen - 24.02.2010
You have like one single point where you can buy? Or a square where you can buy it?
Re: car shop/dealer -
security - 24.02.2010
Quote:
Originally Posted by VonLeeuwen
You have like one single point where you can buy? Or a square where you can buy it?
|
I got only the coordinates and the zone have a color. But now i need to make /buy and /prices and that you only can uses those commands at the car dealer(s) i am going to make 3 car dealers but i like to start with one coordinates are in first post. It is at San Fiere wang cars.
Re: car shop/dealer -
VonLeeuwen - 24.02.2010
And what is the exact location you want him to buy from? (The Coordinates?)
Because GangZoneCreate is a square (gangzone), type /save at the location you want.
Re: car shop/dealer -
security - 24.02.2010
Do you mean where the car spawns? that is at: -2989.536 , 270.5747 , 15, ( AddStaticVehicle(400, -2989,536, 270,5747, 15, 0, -1, -1);
so i found the right location
i cant go into sa-mp i will get bsod
xD
and the /buy command must be in the whole gangzone thing xD
Re: car shop/dealer -
VonLeeuwen - 24.02.2010
Ok, thats what I meant.. Give me 10 minutes, I'll try to fix something for you.
Ok, I got you a small function, which checks if the player is in the area, when he types /buy. Now, you will have to use
ShowPlayerDialog, to get a menu popped up.
Under OnPlayerCommandText:
pawn Код:
if(strcmp(cmdtext,"/buy", true) == 0)
{
if(IsPlayerInArea(playerid, -2000.689, -1915.71, 262.6848, 329.7492))
{
//do the actions (ShowPlayerDialog)
}
else
{
SendClientMessage(playerid,0xFF0000AA,"You are not in the required area!");
}
return 1;
}
At the bottom of your script (you dont need this code, you dont have to understand it either):
pawn Код:
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) return 1;
return 0;
}
Re: car shop/dealer -
security - 24.02.2010
Quote:
Originally Posted by VonLeeuwen
Ok, thats what I meant.. Give me 10 minutes, I'll try to fix something for you.
|
ok, ty for your help. Could you make some explain message in it. So i can make more car dealers?