littlewhitey's Servers Forum (SA-MP/VC-MP/MTA/Zomboid)
SA-MP Server - 54.38.156.202:7777 => General => Topic started by: Fuse on June 18, 2014, 08:00:26 PM
-
#include <a_samp>
#if defined MAX_PLAYERS
#undef MAX_PLAYERS
#endif
#define MAX_PLAYERS 32
new playerPrevWorld[MAX_PLAYERS],
maxPlayers;
public OnFilterScriptInit()
maxPlayers = GetMaxPlayers();
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid)
{
if(enterexit) // Enter
{
playerPrevWorld[playerid] = GetPlayerVirtualWorld(playerid);
SetVehicleVirtualWorld(vehicleid, playerid);
for(new veh_playerid = 0; veh_playerid < maxPlayers; veh_playerid ++)
{
if(IsPlayerConnected(veh_playerid) && GetPlayerVehicleID(veh_playerid) == vehicleid)
SetPlayerVirtualWorld(veh_playerid, playerid);
}
}
else // Exit
{
SetVehicleVirtualWorld(vehicleid, playerPrevWorld[playerid]);
for(new veh_playerid = 0; veh_playerid < maxPlayers; veh_playerid ++)
{
if(IsPlayerConnected(veh_playerid) && GetPlayerVehicleID(veh_playerid) == vehicleid)
SetPlayerVirtualWorld(veh_playerid, playerPrevWorld[playerid]);
}
}
}
}
With this cars don't collide with eachothers inside the modshops because all vehicles inside the shops are set to empty virtual worlds.
I just made it and i hope you add it to the server :)
-
#include <a_samp>
#if defined MAX_PLAYERS
#undef MAX_PLAYERS
#endif
#define MAX_PLAYERS 32
new playerPrevWorld[MAX_PLAYERS],
maxPlayers;
public OnFilterScriptInit()
maxPlayers = GetMaxPlayers();
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid)
{
if(enterexit) // Enter
{
for(new worldid = 0; worldid < maxPlayers; worldid ++)
{
new world_players;
for(new world_playerid = 0; world_playerid < maxPlayers; world_playerid ++)
{
if(IsPlayerConnected(world_playerid) && playerid != world_playerid && GetPlayerVirtualWorld(world_playerid) == worldid)
world_players ++;
}
if(!world_players)
{
playerPrevWorld[playerid] = GetPlayerVirtualWorld(playerid);
SetVehicleVirtualWorld(vehicleid, worldid);
LinkVehicleToInterior(vehicleid, interiorid);
for(new veh_playerid = 0; veh_playerid < maxPlayers; veh_playerid ++)
{
if(IsPlayerConnected(veh_playerid) && GetPlayerVehicleID(veh_playerid) == vehicleid)
{
SetPlayerVirtualWorld(veh_playerid, worldid);
SetPlayerInterior(veh_playerid, interiorid);
}
}
break;
}
}
}
else // Exit
{
SetVehicleVirtualWorld(vehicleid, playerPrevWorld[playerid]);
LinkVehicleToInterior(vehicleid, 0);
for(new veh_playerid = 0; veh_playerid < maxPlayers; veh_playerid ++)
{
if(IsPlayerConnected(veh_playerid) && GetPlayerVehicleID(veh_playerid) == vehicleid)
{
SetPlayerVirtualWorld(veh_playerid, playerPrevWorld[playerid]);
SetPlayerInterior(veh_playerid, 0);
}
}
}
}
}
With this you can enter modshops as passenger, also cars don't collide with eachothers inside the modshops because all vehicles inside the shops are set to empty virtual worlds.
I just made it and i hope you add it to the server :)
It is really a good idea (cuz i hate the car get damaged, and cant see the parts i did :o) if i can gove my vote (+1)
-
Im the first who tested it,works really nice though.Good work fuse! ;)
-
@Playa: colliding cars inside modshops do not take damage.
Apart from that good work Fuse. I like it.
It's annoying if someone pushes your car aside and you don't see how the added parts look.
-
nice one!
-
I'm not into pawn but wouldn't it be far easier to just put the player into the virtual world with the same ID as his player ID once he enters the modshop?
-
I'm not into pawn but wouldn't it be far easier to just put the player into the virtual world with the same ID as his player ID once he enters the modshop?
It would, i made it this way just to be 100% sure that you enter an empty shop
-
I don't get it. What is more unique than the player ID?
-
Probably that.Fuse knows the best,so better listen to him. :)
-
Actually i think i overthinked it, both ways should work just as good :)
Edited the first post
-
Now this is something interesting! :) Good work! n1 mate!