How to define a vehicle with a special vehicle id
#1

What I did was

pawn Код:
public OnGameModeInit()
    {
        new Hotwire1 = AddStaticVehicle(549, 1669.7079, 1286.9500, 10.5176, 359.8699, 75, 39);
        }
How do I define the vehicle?
Reply
#2

It is defined, by the variable "Hotwire1"

What are you trying to do with the defined vehicle?
Reply
#3

pawn Код:
command(hotwire, playerid, params[])
    {
        if(GetPlayerVehicleID(playerid) == Hotwire1)
        {
            SetTimerEx("Hotwiring", 2000, false, "i", playerid);
            GameTextForPlayer(playerid, "~r~Hotwiring", 5000, 1);
        }
    }
   
    forward Hotwiring(playerid);
    public Hotwiring(playerid)
    {
        new string[200], pstring[200];
        SetTimerEx("Hotwiring1", 1000*5, false, "i", playerid);
        format(string, sizeof(string), "You have taken out your toolbox, afterwards taking out a hammer from the toolbox, smashing the bottom dashboard.");
        SendClientMessage(playerid, ACTION, string);
        format(pstring, sizeof(pstring), "%s has taken out his toolbox, afterwards taking out a hammer from it, smashing the bottom dashboard.");
        SetPlayerChatBubble(playerid, pstring, ACTION, 30.0, 1000*5);  
    }
   
    forward Hotwiring2(playerid);
    public Hotwiring2(playerid)
    {
        new string[200], pstring[200];
        SetTimerEx("Hotwiring2", 1000*5, false, "i", playerid);
        format(string, sizeof(string), "hi");
        SendClientMessage(playerid, ACTION, string);
        format(pstring, sizeof(pstring), "hi");
        SetPlayerChatBubble(playerid, pstring, ACTION, 30.0, 1000*5);
    }
What I did so far
Reply
#4

Is it not working? Well, first the code above is missing return's. Also, there is a better (working) way of defining the vehicle.

Try this:

pawn Код:
//Include at the top of your script (with all the other defined variables)
new Hotwire1[1];//The 1 represents the number of vehicles within Hotwire1, each will have it's own ID attached with Hotwire1.

public OnGameModeInit()    
{
      Hotwire1[0] = AddStaticVehicleEx(549, 1669.7079, 1286.9500, 10.5176, 359.8699, 75, 39);//Yeah, 0 is a number here, but not when we defined it... kind of confusing.
      //Rest of OnGameModeInit code...
      return 1;
}

command(hotwire, playerid, params[])    
{
        if(GetPlayerVehicleID(playerid) == Hotwire1[0])        
        {            
              SetTimerEx("Hotwiring", 2000, false, "i", playerid);            
              GameTextForPlayer(playerid, "~r~Hotwiring", 5000, 1);
              return 1;      
        }    
}

//Timers just like you have them above, BUT YOU NEED RETURNS! (return 1; at the end of everything).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)