10.02.2011, 18:24
pawn Код:
if(strcmp(cmd,"/accepttow",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:x,Float:y,Float:z;
GetPlayerPos(TRequested[playerid], x, y, z);
if(IsPlayerInRangeOfPoint(playerid,8.0, x, y, z))
{
if(GetPlayerState(playerid) == 2 || GetPlayerState(playerid) == 3)
{
new vid = GetPlayerVehicleID(playerid);
if(TRequested[playerid] == 9999)
{
SendClientMessage(playerid,COLOR_RED,"Noone offered you a tow!");
return 1;
}
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),"You have accepted the towing from ID %d",TRequested[playerid]);
SendClientMessage(playerid,COLOR_LIGHTRED,string);
format(string,sizeof(string),"%s has accepted your tow request",pname);
SendClientMessage(TRequested[playerid],COLOR_LIGHTRED,string);
new vid2 = GetPlayerVehicleID(TRequested[playerid]);
AttachTrailerToVehicle(vid,vid2);
TRequested[playerid] = 9999;
TCar[playerid] = 0;
}
else
{
SendClientMessage(playerid,COLOR_RED,"You should be the driver!");
}
}
else
{
SendClientMessage(playerid,COLOR_RED,"That player is not near you!");
}
}
else
{
SendClientMessage(playerid,COLOR_RED,"Wrong id!");
}
}
return 1;
}