Vehicle spawn bug
#3

pawn Код:
//Commands
if (strcmp("/abike", cmdtext, true, 10) == 0)
    {
     CarSpawner(playerid,522);
            return 1;
    }
    if (strcmp("/acar", cmdtext, true, 10) == 0)
    {
  CarSpawner(playerid, 429);
            return 1;
    }

forward CarSpawner(playerid,model);
public CarSpawner(playerid,model)
{
    if(IsPlayerInAnyVehicle(playerid))  ShowPlayerDialog(playerid,293574,DIALOG_STYLE_MSGBOX ,"Error","You are already in a vehicle.Leave the vehicle and use the command again.","ok","Cancel");
    else
    {
        new Float:x, Float:y, Float:z, Float:angle;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, angle);
        new vehicleid=CreateVehicle(model, x, y, z, angle, -1, -1, -1);
        PutPlayerInVehicle(playerid, vehicleid, 0);
        SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
        LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
        ChangeVehicleColor(vehicleid,0,7);
    }
    return 1;
}
And yeah one more command from ladmin which is /car model color color player can use that too here it is

pawn Код:
dcmd_car(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 0) {
        new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
        if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /car [Modelid/Name] [colour1] [colour2]");
        new car, colour1, colour2, string[128];
        if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
        if(car < 400 || car > 611) return  SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
        if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
        if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
        if(PlayerInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid) ) CarDeleter(PlayerInfo[playerid][pCar]);
        new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1;   GetPlayerPos(playerid, X,Y,Z);  GetPlayerFacingAngle(playerid,Angle);   int1 = GetPlayerInterior(playerid);
        LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1); LinkVehicleToInterior(LVehicleID,int1);
        PlayerInfo[playerid][pCar] = LVehicleID;
        format(string, sizeof(string), "%s spawned a \"%s\" (Model:%d) colour (%d, %d), at %0.2f, %0.2f, %0.2f", pName(playerid), VehicleNames[car-400], car, colour1, colour2, X, Y, Z);
        SaveToFile("CarSpawns",string);
        format(string, sizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)", VehicleNames[car-400], car, colour1, colour2);
        return SendClientMessage(playerid,lightblue, string);
    } else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}
Please reply fast
Reply


Messages In This Thread
Vehicle spawn bug - by Black Wolf - 19.09.2012, 15:21
Re: Vehicle spawn bug - by BlueGames - 19.09.2012, 15:26
Re: Vehicle spawn bug - by Black Wolf - 19.09.2012, 15:29
Re: Vehicle spawn bug - by BlueGames - 19.09.2012, 15:32
Re: Vehicle spawn bug - by Black Wolf - 19.09.2012, 15:32
Re: Vehicle spawn bug - by Black Wolf - 19.09.2012, 16:44
Re: Vehicle spawn bug - by Black Wolf - 20.09.2012, 01:20
Re: Vehicle spawn bug - by Black Wolf - 21.09.2012, 03:26
Re: Vehicle spawn bug - by Lordzy - 21.09.2012, 03:30
Re: Vehicle spawn bug - by Black Wolf - 21.09.2012, 03:37

Forum Jump:


Users browsing this thread: 2 Guest(s)