CMD:stretcher(playerid, params[])
{
static
type[24],
Float:x,
Float:y,
Float:z,
Float:angle;
if (GetFactionType(playerid) != FACTION_MEDIC)
return SendErrorMessage(playerid, "You do not have permission to use this command.");
if (!strcmp(type, "get", true))
{
for (new i = 0; i != MAX_VEHICLES; i ++) if (IsPlayerNearBoot(playerid, i) && GetVehicleModel(i) == 416)
{
SetPlayerAttachedObject(playerid, 1, 1997, 1, -1.106504, 1.504988, 0.031584, 0.000000, 89.566635, 0.000000);
}
}
if (!strcmp(type, "drop", true))
{
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
RemovePlayerAttachedObject(playerid, 1);
CreateObject(1997, x, y, z-1, 0.0, 0.0, 0.0, 50.0);
SetPlayerPos(playerid, x-1, y, z);
}
return 1;
}
CMD:stretcher(playerid, params[]) { static type[24], Float:x, Float:y, Float:z, Float:angle; if (GetFactionType(playerid) != FACTION_MEDIC) return SendErrorMessage(playerid, "You do not have permission to use this command."); if (!strcmp(type, "get", true)) { for (new i = 0; i != MAX_VEHICLES; i ++) if (IsPlayerNearBoot(playerid, i) && GetVehicleModel(i) == 416) { SetPlayerAttachedObject(playerid, 1, 1997, 1, -1.106504, 1.504988, 0.031584, 0.000000, 89.566635, 0.000000); } } if (!strcmp(type, "drop", true)) { GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, angle); RemovePlayerAttachedObject(playerid, 1); CreateObject(1997, x, y, angle, 0.0, 0.0, 0.0, 50.0); SetPlayerPos(playerid, x-1, y, z); } return 1; }
Try this:
Код:
CMD:stretcher(playerid, params[]) { static type[24], Float:x, Float:y, Float:z, Float:angle; if (GetFactionType(playerid) != FACTION_MEDIC) return SendErrorMessage(playerid, "You do not have permission to use this command."); if (!strcmp(type, "get", true)) { for (new i = 0; i != MAX_VEHICLES; i ++) if (IsPlayerNearBoot(playerid, i) && GetVehicleModel(i) == 416) { SetPlayerAttachedObject(playerid, 1, 1997, 1, -1.106504, 1.504988, 0.031584, 0.000000, 89.566635, 0.000000); } } if (!strcmp(type, "drop", true)) { GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, angle); RemovePlayerAttachedObject(playerid, 1); CreateObject(1997, x, y, angle, 0.0, 0.0, 0.0, 50.0); SetPlayerPos(playerid, x-1, y, z); } return 1; } |
CMD:stretcher(playerid, params[]) { static type[24], Float:x, Float:y, Float:z, Float:angle; if (GetFactionType(playerid) != FACTION_MEDIC) return SendErrorMessage(playerid, "You do not have permission to use this command."); if (!strcmp(type, "get", true)) { for (new i = 0; i != MAX_VEHICLES; i ++) if (IsPlayerNearBoot(playerid, i) && GetVehicleModel(i) == 416) { SetPlayerAttachedObject(playerid, 1, 1997, 1, -1.106504, 1.504988, 0.031584, 0.000000, 89.566635, 0.000000); } } if (!strcmp(type, "drop", true)) { GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, angle); RemovePlayerAttachedObject(playerid, 1); CreateObject(1997, x, y, z-1, 0.0, 0.0, 0.0, 50.0); SetObjectRot(objectid, x, y, angle); SetPlayerPos(playerid, x-1, y, z); } return 1; }
CMD:stretcher(playerid, unused[]) {
#pragma unused unused
if(GetFactionType(playerid) != FACTION_MEDIC) {
return SendErrorMessage(playerid, "You do not have permission to use this command.");
}
new
Float: X,
Float: Y,
Float: Z
;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) {
new
Float: A
;
GetPlayerFacingAngle(playerid, A);
CreateObject(1997, X - floatsin(A, degrees), Y + floatcos(A, degrees), Z - 1.0, 0.0, 0.0, A, 50.0);
RemovePlayerAttachedObject(playerid, 1);
} else {
for (new i = 1; i <= MAX_VEHICLES; i++) { // vehicleid start at 1
if (GetVehicleModel(i) == 416 && GetVehicleDistanceFromPoint(i, X, Y, Z) < 10.0) {
SetPlayerAttachedObject(playerid, 1, 1997, 1, -1.106504, 1.504988, 0.031584, 0.000000, 89.566635, 0.000000);
return true; // stop the loop
}
}
SendClientMessage(playerid, -1, "You need to be next to an ambulance");
}
return true;
}
CreateObject(1997, x, y, z-1, 0.0, 0.0, angle, 50.0);