Ownable vehicles help
#1

Hey guys,

what do I do here?
This is to give a player the vehicle for Turismo?:
pawn Код:
case DIALOG_CARSHOP:
        {
            if(!response) return 0;
            if(response)
            {
                switch(listitem) // Turismo/nSuperGT/nSultan
                {
                    case 0:
                }
            }
            return 1;
        }
enums
pawn Код:
enum vehInfo {
    vehID,
    vName[MAX_VEHICLE_NAME],
    vPrice,
    Float:vPosX,
    Float:vPosY,
    Float:vPosZ,
    Float:vPosA,
    vModel,
    vOwned,
    vPlate[8],
    vOwner[MAX_PLAYER_NAME],
    vCol1,
    vCol2,
}
new VehicleInfo[200][vehInfo];
Note: PlayerInfo[playerid][vehicleID] is for the player enum for vehicle ID.

pawn Код:
CMD:buycar(playerid, params[])
{
    ShowPlayerDialog(playerid,DIALOG_CARSHOP,DIALOG_STYLE_LIST,"Choose a vehicle","Turismo/nSuperGT/nSultan","Choose","Cancel");
    return 1;
}
Reply
#2

what do you want to do spawn the turismo make the enum variable for the id of the turismo ?
Quote:

This forum requires that you wait 120 seconds between posts

Again ;X
Reply
#3

How? That's what I need help with.

Or can you make a command called /car and it'll give me a car but also give my player all the required info.

Something like this?

new id = GetPlayerVehicleID(playerid);

playerVariables[playerid][pVehicleID] = id;
Reply
#4

so you want a cmd /car [vehicle name] and when it spawns to give the enum its id ?
Reply
#5

No..
Basically I'm making a RP server.

And I need a vehicle ownership system..

All I'm asking for at the moment (I'll advance it later) is a command just /car
and it'll give all the info to give the player the vehicle like it's his own car.

So when you go to a dealership on another server it gives you the vehicle.

I need that code.
Reply
#6

well..
pawn Код:
COMMAND:car(playerid)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"You Need to be in a vehicle");
new vehicle = GetPlayerVehicleID(playerid);
new Name[MAX_PLAYER_NAME];GetPlayerName(playerid,Name,sizeof(Name));
if(!Strcmp(vOwned[vehicle],Name);
      {
            new Str[126];format(Str,sizeof(Str),"Owner: %s, Price: %d, Plate: %s",Name,playerVariables[playerid][vPrice],playerVariables[playerid][vPlate]);
      }else return SendClientMessage(playerid,-1,"Not Your Vehicle");
}
something like this ?
Reply
#7

Now if a player bought that, how'd I set the info so it's his private car?
Reply
#8

pawn Код:
VehicleInfo[vehicleid][vOwned] = 1;
GetPlayerName(playerid, VehicleInfo[vehicleid][vOwner], MAX_PLAYER_NAME);
Reply
#9

^ Nope.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(VehicleInfo[vehID][vOwned] == 1)
    {
        SendClientMessage(playerid, -1, "This vehicle is owned.");
    }
    else
    {
        SendClientMessage(playerid, -1, "This vehicle isn't owned.");
    }
    return 1;
}
I added this to check if the vehicle was owned and it returns that it isn't,

pawn Код:
CMD:car(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"You Need to be in a vehicle");
    new veh = GetPlayerVehicleID(playerid);
    VehicleInfo[veh][vOwned] = 1;
    PlayerInfo[playerid][vehicleID] = veh;
    SendClientMessage(playerid, -1, "Bought.");
    return 1;
}
Reply
#10

Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)