More help..
#1

Remove please
Reply
#2

Try this, and if dont work PM me.
pawn Код:
CMD:car(playerid, params[])
{
    if(DMZone[playerid] == 1)
    SendClientMessage(playerid, COLOR_RED,"ERROR: You are in a DM Zone, you must go /home and try again!");
    SendClientMessage(playerid, COLOR_ORANGE,"USAGE: /car [name|id]");
    //if(carspawn[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"ERROR: You already have a car spawned, you must /destroyveh first!");
    if(carid == 544 || carid == 432 || carid == 601 || carid == 425 || carid == 476 || carid == 447 || carid == 520 || carid == 430 || carid == 464 || carid == 465 || carid == 501) return SendClientMessage(playerid, COLOR_RED, "ERROR: You may not spawn an armed or otherwise dangerous vehicle. If you were not trying to, try entering the full vehicle name.");

    if(DMZone[playerid] == 0)
    {
        new vehid = GetVehicleModelIDFromName(params);
        new vehicle = GetVehicleModelIDFromName(params);

        if(!IsNumeric(params)) { // vehid = strval(params);
        vehid = GetVehicleModelIDFromName(params);
        }
        if(IsNumeric(params)) vehid = strval(params);
        if(vehid < 400 || vehid > 611)
    SendClientMessage(playerid,COLOR_RED,"[ERROR] Vehicle ID cannot be below 400 or above 611 or false name given.");
        new Float:x, Float:y, Float:z;
        new Float:a,
        string[128];
        GetPlayerFacingAngle(playerid, a);
        GetPlayerPos(playerid, x, y, z);

        if(IsPlayerInAnyVehicle(playerid) == 1)
        {
            GetXYInFrontOfPlayer(playerid, x, y, 8);
        }
        else
        {
            GetXYInFrontOfPlayer(playerid, x, y, 5);
        }

        new in;
        if(carspawn[playerid] == 1)
        {
            DestroyVehicle(carspawn[playerid]);
        }
        carspawn[playerid] = CreateVehicle(vehid, x, y, z, a+90, -1, -1, 999999999999999999999);
        PutPlayerInVehicle(playerid,carspawn,0)
        carspawn[playerid] = 1;
        LinkVehicleToInterior(in, GetPlayerInterior(playerid));
        if(!IsNumeric(params))
        {
            format(string, sizeof(string), "INFO: You have spawned a %s", aVehicleNames[vehicle - 400]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            carspawn[playerid] = 1;
        }
        if(IsNumeric(params))
        {
            format(string, sizeof(string), "INFO: You have spawned a %s", aVehicleNames[vehid - 400]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

    }
    return 1;
}
Reply
#3

Thanks for helping me out, I got the thing working, I actually made the command look a little neater.... Anyways

the issue I have is OnPlayerDisconnect, when a player leaves I want there cars to be deleted but when I put DestroyVehicle(carspawn[playerid]); under that, it deletes all spawned vehicles
Reply
#4

Obviously, you will have to replace AddStaticVehicle with CreateVehicle. I mean, static vehicles never return an ID. Or do they?
Reply
#5

Static Vehicles should be for Trams / Trains (as they need to load synced to tracks).
Reply
#6

BUMP
Reply
#7

BUMP
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)