[Tutorial] Mod Shop Bug Fix
#1

For some people, There mod shop is bugged, you go in, then someone else goes in behind you, And then your both crashing into eachother in the mod shop.

Well here is how i fixed the bug for my server (Not sure if it happens to everyone, but i thought i'd share).


First, The callback.

Search in your GameMode/Filterscript for
pawn Code:
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
       return 1;
}
Next, directly under the first curly bracket
pawn Code:
{
Add this code.

pawn Code:
new vehid;
    vehid = GetPlayerVehicleID(playerid);
    SetPlayerVirtualWorld(playerid, random(555)+random(999));
    SetVehicleVirtualWorld(vehid, GetPlayerVirtualWorld(playerid));
    PutPlayerInVehicle(playerid, vehid, 0);
   
    if(enterexit == 0)
    {
        SetVehicleVirtualWorld(vehid, 0);
        SetPlayerVirtualWorld(playerid, 0);
        PutPlayerInVehicle(playerid, vehid, 0);
    }
So at end, it will look like..

pawn Code:
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
    new vehid;
    vehid = GetPlayerVehicleID(playerid);
    SetPlayerVirtualWorld(playerid, random(555)+random(999));
    SetVehicleVirtualWorld(vehid, GetPlayerVirtualWorld(playerid));
    PutPlayerInVehicle(playerid, vehid, 0);
   
    if(enterexit == 0)
    {
        SetVehicleVirtualWorld(vehid, 0);
        SetPlayerVirtualWorld(playerid, 0);
        PutPlayerInVehicle(playerid, vehid, 0);
    }
    return 1;
}

Now let me explain what everything does.

The callback.
pawn Code:
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
       //This is where your code/script/data gets processed/executed ingame.
       return 1;
}
The variable
pawn Code:
new vehid; //Setting the variable for the players car to save to
The virtual worlds.
pawn Code:
SetPlayerVirtualWorld(playerid, random(555)+random(999)); //Sets the players virtual world
    SetVehicleVirtualWorld(vehid, GetPlayerVirtualWorld(playerid)); //Puts his car, in his virtual world
PutPlayerInVehicle(playerid, CARID, seat);
pawn Code:
PutPlayerInVehicle(playerid, vehid, 0); //Puts the player in vehicle.
For more information on PutPlayerInVehicle, Click this line.

The "if" Statement.
pawn Code:
if(enterexit == 0)
    {
//This checks it the player has EXITED, the mod garage (1 for enter)
//And then script/code gets put in here.
     }
And there you go. Very simple tut to a very annoying bug i kept running into.
Reply


Messages In This Thread
Mod Shop Bug Fix - by DiddyBop - 31.08.2010, 12:23
Re: Mod Shop Bug Fix - by Vince - 31.08.2010, 13:14
Re: Mod Shop Bug Fix - by DiddyBop - 31.08.2010, 16:57
AW: Mod Shop Bug Fix - by FufLa - 31.08.2010, 18:28
Re: Mod Shop Bug Fix - by AndriusZ* - 31.08.2010, 18:34
Re: Mod Shop Bug Fix - by DiddyBop - 01.09.2010, 15:07
Re: Mod Shop Bug Fix - by willsuckformoney - 05.09.2010, 17:52
Re: Mod Shop Bug Fix - by DiddyBop - 06.09.2010, 02:00
Re: Mod Shop Bug Fix - by willsuckformoney - 06.09.2010, 02:06
Re: Mod Shop Bug Fix - by General Abe - 03.10.2010, 15:50
Re: Mod Shop Bug Fix - by ••• ĤБĶБM ••• - 25.10.2010, 13:23
Re: Mod Shop Bug Fix - by DiddyBop - 14.11.2010, 00:23
Re: Mod Shop Bug Fix - by Mariooo - 29.12.2010, 08:36
Re: Mod Shop Bug Fix - by Fool - 29.12.2010, 10:46

Forum Jump:


Users browsing this thread: 3 Guest(s)