SA-MP Forums Archive
/getcar cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /getcar cmd (/showthread.php?tid=300405)



/getcar cmd - diego_p11 - 30.11.2011

I. Have been loocking for a /getcar cmd.
Could someone help with that cmd plz.


Re: /getcar cmd - moadi - 30.11.2011

What do you mean by getcar, a command that creates a vehicle? anyway you should use the search button or the request thread, also, could be easier if you post more informations such as which command proccessor do you use.


Re: /getcar cmd - fordawinzz - 30.11.2011

pawn Код:
CMD:getcar(playerid, params[])
{
    new carid;
    if(sscanf(params, "i", carid)) return SendClientMessage(playerid, ~1, "USAGE: /getcar [carid]");
    if(carid > MAX_VEHICLES) return SendClientMessage(playerid, ~1, "That  vehicle does not exists.");
    new Float: gPos[3];
    GetPlayerPos(playerid, gPos[0], gPos[1], gPos[2]);
    SetVehiclePos(carid, gPos[0] + 2, gPos[1], gPos[2]);
    return 1;
}



Re: /getcar cmd - Thresholdold - 30.11.2011

By getcar are you trying to create a car, or just find one?


Re: /getcar cmd - diego_p11 - 30.11.2011

to get a car, an already existing car


Re: /getcar cmd - MP2 - 30.11.2011

pawn Код:
CMD:getvehicle(playerid, params[])
{
    new vehicleid;
    if(sscanf(params, "i", vehicleid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /getvehicle [vehicleid]");
    if(GetVehicleModel(vehicleid) == 0 || vehicleid >= MAX_VEHICLES) return SendClientMessage(playerid, COLOR_RED, "That  vehicle does not exist.");
    new Float:playerPos[3];
    GetPlayerPos(playerid, playerPos[0], playerPos[1], playerPos[2]);
    GetXYInFrontOfPlayer(playerid, playerPos[0], playerPos[1], 5.0);
    SetVehiclePos(vehicleid, playerPos[0], playerPos[1], playerPos[2]);
    return 1;
}

GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    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));
}
Not tested.