#include <a_samp>
#define DEBUG false
bool:IsPlayerInSphere( playerid, Float:r, Float:x, Float:y, Float:z )
{
new Float:xx, Float:yy, Float:zz;
GetPlayerPos( playerid, xx, yy, zz );
xx -= x;
yy -= y;
zz -= z;
return ( ( xx * xx ) + ( yy * yy ) + ( zz * zz ) < ( r * r ) );
}
new stepTimer, bool:pInModshop[MAX_PLAYERS], pVehicle[MAX_PLAYERS], pWorld[MAX_PLAYERS];
public OnFilterScriptInit()
{
stepTimer = SetTimer( "Step", 500, true );
return 1;
}
public OnFilterScriptExit()
{
KillTimer( stepTimer );
}
public OnPlayerConnect( playerid )
{
pInModshop[playerid] = false;
}
forward Step();
public Step()
{
new playerid, vehicleid, Float:x, Float:y, Float:z;
for ( playerid = 0; playerid < GetMaxPlayers(); playerid++ )
{
if ( !IsPlayerConnected( playerid ) )
continue;
GetPlayerPos( playerid, x, y, z );
vehicleid = GetPlayerVehicleID( playerid );
if ( IsPlayerInSphere( playerid, 8.0, 617.5380, -1.9900, 1000.6829 ) ||
IsPlayerInSphere( playerid, 8.0, 616.7803, -74.8151, 997.7710 ) ||
IsPlayerInSphere( playerid, 8.0, 615.2800, -124.2392, 997.6360 ) )
{
if ( pInModshop[playerid] )
continue;
pWorld[playerid] = GetPlayerVirtualWorld( playerid );
pInModshop[playerid] = true;
pVehicle[playerid] = vehicleid;
if ( vehicleid != 0 )
SetVehicleVirtualWorld( vehicleid, 56 + playerid );
SetPlayerVirtualWorld( playerid, 56 + playerid );
#if DEBUG == true
SendClientMessage( playerid, 0xFFFFFFFF, "* Modshop enter." );
#endif
}
else if ( pInModshop[playerid] )
{
if ( vehicleid != 0 )
SetVehicleVirtualWorld( vehicleid, pWorld[playerid] );
if ( pVehicle[playerid] != 0 && pVehicle[playerid] != vehicleid )
{
SetVehicleVirtualWorld( pVehicle[playerid], pWorld[playerid] );
SetVehicleToRespawn ( pVehicle[playerid] );
}
SetPlayerVirtualWorld( playerid, pWorld[playerid] );
pInModshop[playerid] = false;
#if DEBUG == true
SendClientMessage( playerid, 0xFFFFFFFF, "* Modshop exit." );
#endif
}
}
}
|
Originally Posted by CroAtTheTop
Can about few players at the same time mod their vehicles in the same modshop with this FS too?
|
|
Originally Posted by !Karlip
Thanks,
this should be built into SA-MP srsly. It's annoying :P |

if (!IsPlayerConnected(playerid))
continue;
if (IsPlayerConnected(playerid))
continue;
|
Originally Posted by MJφ
That's good , but i think :
pawn Код:
pawn Код:
|
if(!IsPlayerConnected(playerid)) break;