27.04.2014, 12:52
Hey Guys! Hope Everything's Fine 
Guys i'm having problem with car spawn points.
I Saved The Spawn Points From Other Server But When I Use Them In My Script It Doesn't Give The Car Exact Place
Please help
Here is my script
Thanks In Advance

Guys i'm having problem with car spawn points.
I Saved The Spawn Points From Other Server But When I Use Them In My Script It Doesn't Give The Car Exact Place

Please help
Here is my script
Код:
#include <a_samp>
enum mbinfo
{
Float:XPOS,
Float:YPOS,
Float:ZPOS,
Float:APOS,
Position[50]
};
new Float:MBSPAWN[][mbinfo] =
{
// Positions, (X, Y, Z, A, Location)
{-151.0971,1660.2383,14.3874,74.6920, "Near /UFO"},
{-2080.4548,1003.0549,62.7379,275.5730, "Near /D3"},
{-538.1281,-60.7757,62.8107,90.8049, "Near /S1"},
{-2389.3335,-1864.7722,404.8625,99.3095, "Near /CH"},
{-2584.6609,-2181.7393,28.3840,299.9372, "Near /N4"},
{488.7863,788.4572,-22.2038,49.4327, "Near /QUARRY"},
{-2738.6692,115.1693,4.3073,4.1170, "Near /ARCH"},
{2522.1445,-1711.4204,13.3435,87.7278, "Near /GROVE"},
{2156.1533,1685.6608,10.5037,179.7841, "Near /LV"}
};
new Float:CarPos[4], CarFound=1, CarLocation[50], CarID, Timer[2];
//Hours, Minutes, Seconds, Milliseconds
#define MoneyBagDelay(%1,%2,%3,%4) (%1*3600000)+(%2*60000)+(%3*1000)+%4
#define CarDestroy(%1,%2,%3,%4) (%1*3600000)+(%2*60000)+(%3*1000)+%4
//3 mins!
#define MB_DELAY MoneyBagDelay(0, 3, 0, 0)
#define CAR_DESTROYA CarDestroy(0,2,0,0)
public OnFilterScriptInit()
{
Timer[1] = SetTimer("CarEvent", MB_DELAY, true);
Timer[1] = SetTimer("CarDestroyed",CAR_DESTROYA, true);
return 1;
}
forward CarEvent();
public CarEvent()
{
new string[175];
if(!CarFound)
{
format(string, sizeof(string), "**The {33FF66}car {FFFFFF}has {FF0000} not {FFFFFF} been found, it is still hidden in {FFFF66} %s", CarLocation);
SendClientMessageToAll(-1, string);
}
else if(CarFound)
{
CarFound = 0;
new randombag = random(sizeof(MBSPAWN));
CarPos[0] = MBSPAWN[randombag][XPOS];
CarPos[1] = MBSPAWN[randombag][YPOS];
CarPos[2] = MBSPAWN[randombag][ZPOS];
CarPos[2] = MBSPAWN[randombag][APOS];
format(CarLocation, sizeof(CarLocation), "%s", MBSPAWN[randombag][Position]);
format(string, sizeof(string), "**The {33FF66}car has been {FF0000} hidden in {FFFF66} %s!", CarLocation);
SendClientMessageToAll(-1, string);
CarID = CreateVehicle(605, CarPos[0], CarPos[1], CarPos[2], CarPos[3], -1, -1, -1);
SetVehicleHealth(CarID,9999);
}
return 1;
}
forward CarDestroyed();
public CarDestroyed()
{
new string[175];
if(!CarFound)
{
}
else if (CarFound)
{
DestroyVehicle(CarID);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerAdmin(playerid))
{
if(!strcmp("/gotocar", cmdtext, true))
{
SetPlayerPos(playerid, CarPos[0], CarPos[1]+3, CarPos[2]);
return SendClientMessage(playerid, -1, "You have been {FF0000}teleported {FFFFFF}to the {33FF66}car.");
}
if(!strcmp("/startcar", cmdtext, true)) return CarEvent();
if(!strcmp("/togglecar", cmdtext, true))
{
if(Timer[0] == 0)
{
KillTimer(Timer[1]);
Timer[0] = 1;
SendClientMessage(playerid, -1, "Car event turned {FF0000} off!");
return 1;
}
if(Timer[0] == 1)
{
Timer[1] = SetTimer("CarEvent", MB_DELAY, true);
Timer[0] = 0;
SendClientMessage(playerid, -1, "Car event turned {33FF66} on!");
return 1;
}
return 1;
}
}
if(!strcmp("/findcar", cmdtext, true))
{
new string[150];
if(!CarFound) format(string, sizeof(string), "**The {33FF66}car has been {FF0000}hidden in {FFFF66}%s!", CarLocation);
if(CarFound) format(string, sizeof(string), "**The {33FF66}car event is {FF0000} not running!");
return SendClientMessage(playerid, -1, string);
}
return 0;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == CarID && !CarFound)
{
new string[180], pname[24];
GetPlayerName(playerid, pname, 24);
Timer[1] = SetTimer("CarDestroyed",CAR_DESTROYA, true);
GetPlayerPos(playerid, CarPos[0], CarPos[1], CarPos[2], CarPos[3]);
format(string, sizeof(string), "** {99FFFF}%s{FFFFFF} has found the {33FF66}car{FFFFFF} that had {33FF00}$50,000 and 2 score {FFFFFF}inside, located in %s", pname, CarLocation);
CarFound = 1;
SendClientMessageToAll(-1, string);
SendClientMessage(playerid, -1, "You have found the Car! The Car Will Disappear After 2 Minutes!");
GivePlayerMoney(playerid, 50000);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
}
}
return 1;
}


