BonusCar
#1

Hey Guys!!.
Hope Everything's Fine.
Yet i have another problem with my script.Please Help Me.
First of all here is my script.I'm Very New To Pawno Scripting So I Can't Script Very Well My Self LoL
Код:
#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)
		{2459.0432,-1717.4377,13.2856,15.5244, "Near /GROVE"},
		{-423.5814,1380.5719,13.7437,16.1176, "Near /CVE"},
		{2073.1062,1004.1014,62.6490,290.6085, "Near /D3"},
		{-146.2660,1655.8315,14.7138,190.5782, "Near /UFO"},
		{-473.1016,-172.8944,77.9380,50.5231, "Near /S1"}
};

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);
        }
        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)
                {
                    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);
                GivePlayerMoney(playerid, 50000);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
                SendClientMessage(playerid, -1, "You have found the Car! The Car Will Disappear After 2 Minutes!");
                }
    }
        return 1;
}
So The Problem Is That When I Enter The Car It Gives Me The Money And The Score (Reward).
But If i Spawn Any Car Using /V Or Using The LAdmin /Car Command. It Still Gives Me The Reward.
I Don't Know Why Is This Happening Please Help.If u need to ask anything else please ask it in the reply.
Thanks in Advance.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)