#include <a_samp>
#include sscanf
new TowTruckers=0;
new IsTowTrucker[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (newstate==PLAYER_STATE_DRIVER)
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
{
IsTowTrucker[playerid]=1;
TowTruckers++;
SendClientMessage(playerid,0xFFFF00AA,\"Nyomd meg a CTRL,ALT GR,ALT gombot a vontatáshoz\");
}
else
{
if (TowTruckers>0)
{
SendClientMessage(playerid,0xFFFF00AA,\"Ha probléma van hívd fel a vontatósokat.\");
}
}
}
if ((newstate==PLAYER_STATE_ONFOOT)&&(IsTowTrucker[playerid]==1))
{
IsTowTrucker[playerid]=0;
TowTruckers--;
}
if ((newstate==PLAYER_STATE_PASSENGER)&&(TowTruckers>0))
{
SendClientMessage(playerid,0xFFFF00AA,\"Ha probléma van hívd fel a vontatósokat.\");
}
return 1;
}
//------------------------------------------------------------------------------------------------------
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys==KEY_ACTION)&&(IsPlayerInAnyVehicle(playerid))&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
{
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
new Float:vX,Float:vY,Float:vZ;
new Found=0;
new vid=0;
while((vid<MAX_VEHICLES)&&(!Found))
{
vid++;
GetVehiclePos(vid,vX,vY,vZ);
if ((floatabs(pX-vX)<7.0)&&(floatabs(pY-vY)<7.0)&&(floatabs(pZ-vZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
{
Found=1;
if (IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
}
AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
}
}
if (!Found)
{
SendClientMessage(playerid,0xFFFF00AA,\"Nincs autó a közeledben.\");
}
}
}
}
//------------------------------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid)
{
if (IsTowTrucker[playerid]==1)
{
IsTowTrucker[playerid]=0;
TowTruckers--;
}
return 1;
}
//------------------------------------------------------------------------------------------------------
Itt a CTRL,ALT,ALT GR felakasztod a kocsit és a num8 al pedig le.