30.11.2011, 11:16
I. Have been loocking for a /getcar cmd.
Could someone help with that cmd plz.
Could someone help with that cmd plz.
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;
}
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));
}