Weired and Annoying
#1

pawn Код:
CMD:v(playerid, params[])
{
        new Index;
        new tmp[256];  tmp  = strtok(params,Index);
        new tmp2[256]; tmp2 = strtok(params,Index);
        new tmp3[256]; tmp3 = strtok(params,Index);
        if(!strlen(tmp)) return
        SendClientMessage(playerid, COLOR_RED, "Usage: /car [ModelID/Name] [Colour1] [Colour2]") &&
        SendClientMessage(playerid, COLOR_RED, "Function: Will create a Car with specified Colours");
        new car;
        new string[128];
        new colour1, colour2;
        if(!IsNumeric(tmp))
        car = GetVehicleModelIDFromName(tmp);
        else car = strval(tmp);
        if(car < 400 || car > 611) return  SendClientMessage(playerid, COLOR_BLUE, "ERROR: Invalid Vehicle Model ID!");
        if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
        if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);

        new LVehicleID,pWorld;
        pWorld = GetPlayerVirtualWorld(playerid);
        new Float:X,Float:Y,Float:Z;
        new Float:Angle,int1;
        GetPlayerFacingAngle(playerid,Angle);
        int1 = GetPlayerInterior(playerid);
        GetXYInFrontOfPlayer(playerid, X, Y, 1.5);
        LVehicleID = CreateVehicle(car, X, Y, Z+0.5, Angle+90, colour1, colour2, -1);
        LinkVehicleToInterior(LVehicleID,int1);
        SetVehicleVirtualWorld(LVehicleID, pWorld);
        format(string, sizeof(string), "|- You have Spawned a \"%s\" (Model: %d) with Colours: %d,%d -|", VehicleNames[car-400], car, colour1, colour2);
        return SendClientMessage(playerid, COLOR_BLUE, string);
}


GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{   // Created by ******

    new Float:a;

    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);

    if (GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }

    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
These cmd spawn me a car but on weired way....
i use cmd and i need to wait whole 3 sec!and car spawn's at closest ROAD!
WTF?
And i know about code optimization i will do that later just to find out why is these bug happening...
(Windows server 0.3bR2)
Reply


Messages In This Thread
Weired and Annoying - by DRIFT_HUNTER - 26.11.2010, 20:46
Re: Weired and Annoying - by willsuckformoney - 26.11.2010, 20:53
Re: Weired and Annoying - by DRIFT_HUNTER - 26.11.2010, 20:56

Forum Jump:


Users browsing this thread: 1 Guest(s)