transform car
#1

i need a way for you to type a cmd like /carchange infernus and the car transforms with you in it ive seen it done before.im not askn for the code just how to start it off
Reply
#2

huh? transform what?
Reply
#3

I would assume you would follow these steps in your code:

1. Find which vehicle the player wants to switch to, and save that information in a variable
2. Store the coordinates and rotation/angle of the vehicle the player is in.
3. Remove the player from the vehicle.
4. Destroy the vehicle
5. Create the new vehicle in the same coordinates
6. Put the player into the vehicle
7. Set the vehicle rotation/angle

If you need any guidance to which specific functions you should look into using, don't hesitate to ask! Don't want to give too much away at first as it looks like you want to figure this out yourself
Reply
#4

if(strcmp(cmd, "/rp", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float Float:y Float:z Float:Angle
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,Angle);
if (PlayerInfo[playerid][pAdmin] >= 5)
{
new car;
car = strval(tmp);
if(car == infernus)
{
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
DestroyVehicle(currentveh);
CreateVehicle(411,x,y,z,angle,0,0,3000);
PutPlayerInVehicle(playerid,vehicleid,0);
}
}
}
Reply
#5

Not a bad attempt; just a few errors to correct:
pawn Код:
if(strcmp(cmd, "/rp", true) == 0)
{
    //if(IsPlayerConnected(playerid)) < ----    this check isn't needed: we know the player is connected
    //                                          because he has just typed the command
    //{
        new Float:x, Float:y, Float:z, Float:Angle;
        GetPlayerPos(playerid,x,y,z); // ideally you would use GetVehiclePos when a player is in a vehicle, but it's ok
        GetPlayerFacingAngle(playerid,Angle); // same for this, GetVehicleZPos to find a vehicle rotation angle
        if (PlayerInfo[playerid][pAdmin] >= 5)
        {
            //new car;
            //car = strval(tmp); <--- I'm not sure where tmp comes from
            //if(car == infernus)
            //{
                new currentveh;
                currentveh = GetPlayerVehicleID(playerid);
                DestroyVehicle(currentveh);
                currentveh = CreateVehicle(411,x,y,z,Angle,0,0,3000); // create the new vehicle into the currentveh variable
                PutPlayerInVehicle(playerid,currentveh,0); // put player into the new currentveh
                SetVehicleZAngle(currentveh, Angle); // set the vehicle rotation
            //}
        }
    //}
}
I've left comments on the stuff I have changed. Typing /rp as an admin level 5+ should now transform your vehicle into a black infernus!
Reply
#6

well what i want is so you type /rp (vehicle name) and it transforms ill be adding mrioe cars once i get the infernus done cuz once 1 is down the rest is easy sorry for not explaining to well but thats a detailed help right there
Reply
#7

*******bump************
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)