Добавьте:
В public OnPlayerCommandText(playerid, cmdtext[]):
Код
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/kicksurf", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Используйте: /kicksurf [playerid/PartOfName]");
return 1;
}
if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) != 2) return SendClientMessage(playerid, COLOR_GREY, "Вы не водитель машины!");
new para1;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
if(GetPlayerSurfingVehicleID(para1) == GetPlayerVehicleID(playerid))
{
new Float:p[3];
GetPlayerPos(para1,p[0],p[1],p[2]);
GetXYInBackOfPlayer(para1,p[0],p[1],5.0);
SetPlayerPos(para1,p[0],p[1],p[2]);
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "Игрок не на вашей машине");
}
}//not connected
}
}
return 1;
}
В любое место:
Код
stock GetXYInBackOfPlayer(const playerid, &Float:x, &Float:y, const Float:distance){
new Float:a; GetPlayerPos(playerid, x, y, a); GetPlayerFacingAngle(playerid, a);
if (IsPlayerInAnyVehicle(playerid)) { new vid=GetPlayerVehicleID(playerid);
if (vid>0 && vid<=MAX_VEHICLES)GetVehicleZAngle(vid, a);}
x -= (distance * floatsin(-a, degrees)); y -= (distance * floatcos(-a, degrees));}
Автор: ZioHik