Vehicle won't destroy after spawning another vehicle /image
#6

Try this, just a car command.
pawn Code:
CMD:car(playerid,params[])
{
    new string[128],idx;
    string = strtok(params, idx);
    if(!strlen(string))
    {
        SendClientMessage(playerid,COLOR_GREY, "SERVER: /car [ID] [C1] [C2]");
        return 1;
    }
    new car = strval(string);
    if(car < 400 || car > 611)
    {
        SendClientMessage(playerid, COLOR_GREY, "  VehicleID: 400-611"); return 1;
    }
    string = strtok(params, idx);
    if(!strlen(string))
    {
        SendClientMessage(playerid, COLOR_GREY, "SERVER: /car [ID] [C1] [C2]");
        return 1;
    }
    new color1 = strval(string);
    string = strtok(params, idx);
    if(!strlen(string))
    {
        SendClientMessage(playerid, COLOR_GREY, "SERVER: /car [ID] [C1] [C2]");
        return 1;
    }
    new color2 = strval(string);
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X,Y,Z);
    new v = CreateVehicle(car, X+2,Y,Z, 0.0,color1,color2, -1);
    LinkVehicleToInterior(v,GetPlayerInterior(playerid));
    SetVehicleVirtualWorld(v,GetPlayerVirtualWorld(playerid));
    return 1;
}

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' ')) { index++; }
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    { result[index - offset] = string[index]; index++; }
    result[index - offset] = EOS;
    return result;
}
Reply


Messages In This Thread
Vehicle won't destroy after spawning another vehicle /image - by kbalor - 11.07.2012, 19:43
Re: Vehicle won't destroy after spawning another vehicle /image - by Cxnnor - 11.07.2012, 20:20
Re: Vehicle won't destroy after spawning another vehicle /image - by kbalor - 11.07.2012, 20:29
Re: Vehicle won't destroy after spawning another vehicle /image - by Cxnnor - 11.07.2012, 20:44
Re: Vehicle won't destroy after spawning another vehicle /image - by kbalor - 11.07.2012, 20:48
Re: Vehicle won't destroy after spawning another vehicle /image - by Cxnnor - 11.07.2012, 20:54
Re: Vehicle won't destroy after spawning another vehicle /image - by kbalor - 11.07.2012, 20:59
Re: Vehicle won't destroy after spawning another vehicle /image - by kbalor - 12.07.2012, 06:30
Re: Vehicle won't destroy after spawning another vehicle /image - by clarencecuzz - 12.07.2012, 06:40
Re: Vehicle won't destroy after spawning another vehicle /image - by kbalor - 12.07.2012, 06:43
Re: Vehicle won't destroy after spawning another vehicle /image - by clarencecuzz - 12.07.2012, 06:45
Re: Vehicle won't destroy after spawning another vehicle /image - by kbalor - 12.07.2012, 06:47
Re: Vehicle won't destroy after spawning another vehicle /image - by clarencecuzz - 12.07.2012, 07:05
Re: Vehicle won't destroy after spawning another vehicle /image - by kbalor - 12.07.2012, 11:09
Re: Vehicle won't destroy after spawning another vehicle /image - by clarencecuzz - 12.07.2012, 11:12
Re: Vehicle won't destroy after spawning another vehicle /image - by kbalor - 12.07.2012, 11:43
Re: Vehicle won't destroy after spawning another vehicle /image - by clarencecuzz - 12.07.2012, 11:54
Re: Vehicle won't destroy after spawning another vehicle /image - by kbalor - 12.07.2012, 12:25
Re: Vehicle won't destroy after spawning another vehicle /image - by clarencecuzz - 12.07.2012, 12:38
Re: Vehicle won't destroy after spawning another vehicle /image - by kbalor - 12.07.2012, 12:44

Forum Jump:


Users browsing this thread: 3 Guest(s)