27.10.2018, 18:30
How can I detect, if player is in a car, and if it's, how can I /gethere him with the car and passagers still in IT?
PHP код:
CMD:gethere(playerid,params[])
{
if(pInfo[playerid][pAdminLevel] >= 1)
{
new targetid,string[256], str1[256];
if(sscanf(params, "u", targetid)) SendClientMessage(playerid,-1,""COL_RED"AdmCmds: /gethere [PlayerID]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""COL_RED"ERROR: Not online!");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos_Allow(targetid, x+1, y+1, z+1);
GetPlayerPos(playerid,Float:x,Float:y,Float:z);
SetPlayerVirtualWorld(targetid,GetPlayerVirtualWorld(playerid));
format(string, sizeof(string), ""COL_RED"AdmCmds: %s %s has brought you to himself.", GetAdminName(playerid), PlayerName(playerid));
format(str1, sizeof(str1), ""COL_RED"%s %s used /gethere upon %s.", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid));
SendClientMessage(targetid,-1,string);
SendMessageToAllAdmins(str1,-1);
if(IsPlayerInAnyVehicle(targetid))
{
SetVehiclePos(GetPlayerVehicleID(targetid),x,y,z);
}
}
else {
SendClientMessage(playerid,-1,""COL_RED"EROARE: You are not admin!");
}
return 1;
}