shape1
shape2
shape3
shape4
shape7
shape8

Скинуть игрока с машины


Статус
Закрыто для дальнейших ответов.

Kostyaev

Магистр
Пользователь
19.07.2014
1 123
274
0
26
Ко всем #include:

#include <utils>

В 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

 
Последнее редактирование модератором:
Статус
Закрыто для дальнейших ответов.