[HowTo] Convert Public Enemy LS to 0.3 & PEN1 Questions
#1

[HowTo] Convert Public Enemy LS to 0.3
Feel free to post how to fix something
Hello!
Today I was downloaded Public Enemy LS - The Original, and when I was testing it, it worked fine. Then I had modified some things in gamemode, I was going to test it, but when I spawned I was in house. That is not usual because you shall spawn at motel in Los Santos, not house (actually, in trailer). I saw few guys need help to make it work, so heres a little guide. So now, I got a solution for it - saving system is saving

PLlayerInfo[playerid][plPhousekey] instead of PlayerInfo[playerid][pPhousekey] (also for business), i'm not sure why there is two enumerations with saving data, but OK.

As you maybe saw, under OnPlayerConnect there is
pawn Код:
PlayerInfo[playerid][pPhousekey] = 255;
PlayerInfo[playerid][pPbiskey] = 255;
and PLlayerInfo[playerid][plPhousekey] is not initialized and its value is still zero (which is trailer house's ID).

So, this is how it works on not-modified PENLS

You connect to server, register, your current Phousekey value is 255 (not house) because it is initialized under OnPlayerConnect, but when you disconnect it saves plPhousekey which is zero (trailer house's ID), and next time you connect, it spawns you at that trailer.

What you need to do is to add PLlayerInfo[playerid][plPhousekey] and PLlayerInfo[playerid][plPbiskey] under OnPlayerConnect, so it should look like
pawn Код:
public OnPlayerConnect(playerid)
{
    ....
    PLlayerInfo[playerid][plPhousekey] = 255;
    PLlayerInfo[playerid][plPbiskey] = 255;
    PlayerInfo[playerid][pPhousekey] = 255;
    PlayerInfo[playerid][pPbiskey] = 255;
    ....
    return 1;
}
That's it!

Next step you have to do is to replace OnPlayerUpdate to some other name, lets say OnUpdatePlayer (its not related to houses and business).
You can do it by pressing CTRL+H. In first textbox type OnPlayerUpdate and in second one OnUpdatePlayer.

Now do this
Quote:
Originally Posted by AndryXoX
Add This (by me)

Код:
public OnPlayerSpawn(playerid)
{
	if (gdebug >=1){printf("OnPlayerSpawn Playerid:%d", playerid);}
	new playername[40];
	if (teamcarlock)
	{
		TeamLockDoors(playerid);
	}
	InitLockDoors(playerid);
	if(accountplay)
	{
		if (gdebug >=1){printf("accountplay");}
		if (gPlayerAccount[playerid] == 0)
		{
			gTeam[playerid] = 0;
			GameTextForPlayer(playerid, "~w~Welcome.~n~In order to play you need to create an account, type ~n~~r~/regnick (password)~w~ to register", 20000, 3);
			//SetPlayerInterior(playerid,0);
			SetPlayerInterior(playerid,3);
			PlayerInfo[playerid][pInt] = 3;
			SetPlayerPos(playerid,198.5,162.5,1003.0);
			// airport
			PlayJailSound(1153 , 1154, 2000,264.395200, 77.564040, 1001.039000);
			gPlayerSpawned[playerid] = 1;
  		return 1;
		}
		if (gPlayerLogged[playerid] == 0)
		{
			gTeam[playerid] = 0;
			GameTextForPlayer(playerid, "~w~In order to play you need to log in to your account, type ~n~~g~/login (password)~w~ to log in", 20000, 3);
			//SetPlayerInterior(playerid,0);
			SetPlayerInterior(playerid,3);
			PlayerInfo[playerid][pInt] = 3;
			SetPlayerPos(playerid,198.5,162.5,1003.0);
			// airport
			PlayJailSound(1153 , 1154, 2000,264.395200, 77.564040, 1001.039000);
			gPlayerSpawned[playerid] = 1;
  		return 1;
		}
	}
if (gPlayerSpawned[playerid] == 1)
	{
		gTeam[playerid] = PlayerInfo[playerid][pTeam];
		if (gTeam[playerid] == 2 && forceteam && CopCheck(playerid))
		{
			gTeam[playerid] = 3;
			PlayerInfo[playerid][pTeam] = 3;
			SetPlayerRandomSpawn(playerid);
			SendClientMessage(playerid, COLOR_YELLOW, "SERVER: Your are not allowed to be a cop.");
		}
Edit if (gPlayerSpawned[playerid] == 1) Change 0 to 1
Now follow those instructions (all credits to AndryXoX)
Quote:
Originally Posted by AndryXoX
To correct the mission HotWire (checkpoints)
replace and/or add
pawn Код:
SetVehicleParamsForPlayer(stealcar,i,1,0);
SetPlayerCheckpoint(i,scx, scy, scz,5.0 );
1- On public OnPlayerSpawn(playerid)

Remove first /* switch (MissionActive) }/*
On the line case 9://Car is waiting first occupent
pawn Код:
{
                if (gTeam[playerid] == 1)
                {
                    SendClientMessage(playerid, COLOR_YELLOW, objstore);
                    SetVehicleParamsForPlayer(stealcar,playerid,1,0);
                        SetPlayerCheckpoint(playerid,scx, scy, scz,5.0 );
                }
                else if (gTeam[playerid] == 2)
                {
                SendClientMessage(playerid, TEAM_BLUE_COLOR, cbjstore);
                SetVehicleParamsForPlayer(stealcar,playerid,1,1);
                    SetPlayerCheckpoint(playerid,scx, scy, scz,5.0 );
                }
            }
2- On public PrePlayerNewMission()

pawn Код:
if (MissionActive > 8 && MissionActive < 12)
    {
        if(MissionActive != 0)
        {
            printf("DEBUG: Bad Hotwire: stealcar = %d, stealcardest = %d",stealcar,stealcardest);
            for(new i = 0; i <= MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(stealcar != -1)
                    {
                    SetVehicleParamsForPlayer(stealcar,i,0,0);
                            SetPlayerCheckpoint(i,scx, scy, scz,5.0 );
                        SetVehicleToRespawn(stealcar);
                        stealcar = -1;
                    }
3- Under public SetPlayerNewMission()

On the line case 8:
pawn Код:
{
            if (gdebug){print("DEBUG test1");}
            stealcar = random(166)+88;
            GetVehiclePos(stealcar, scx, scy, scz);
            format(objstore, sizeof(objstore), "SMS: A Buyer Is Interested In The Car Marked On Your GPS, Sender: MOLE (555)");
            format(cbjstore, sizeof(cbjstore), "HQ: 911 10-64 Suspect Vehicle Spotted.");
            rx = scx;//storing the car pos
            ry = scy;
            rz = scz;
            if (gdebug){print("DEBUG TEST2");}
            stealcardest = random(166)+88;
            while (stealcardest == stealcar)
            {
                stealcardest = random(166)+88;
            }
            MissionActive = 9;
            if (gdebug){print("DEBUG MissionActive = 9;");}
            for(new i = 0; i <= MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i) && (gPlayerSpawned[i] == 1))
                {
                    if (gdebug){print("DEBUG test2");}
                    if (gTeam[i] >= 3)
                    {
                        if (automission)
                        {
                            JobGive(i);
                        }
                        else if (PlayerInfo[i][pPnumber] !=0)
                        {
                            SendClientMessage(i, COLOR_YELLOW, "SMS: I Got A Job For You, Text Yes To 555 For More Info, Sender: MOLE (555)");
                            SendClientMessage(i, COLOR_WHITE, "HINT: Type (/sms 555 yes) to get the waypoint from mole");
                            RingTone[i] =20;
                        }
                    }
                    else
                    {
                        if (gdebug){print("DEBUG test4");}
                        SendClientMessage(i, COLOR_DBLUE, cbjstore);
                        GameTextForPlayer(i, "~w~Waypoint set ~n~~y~Suspect Vehicle", 5000, 1);
                        SetPlayerCheckpoint(i,scx, scy, scz,5.0 );
                        SetVehicleParamsForPlayer(stealcar,i,1,1);

                    }
                }
            }
            if (gdebug){printf("DEBUG HOTWIRE mission started: TargetCar:%d",stealcar);}
        return 1;
        }
On the line case 10:
pawn Код:
{
            for(new i = 0; i <= MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if (!IsPlayerInVehicle(i, stealcar))
                    {
    SetPlayerCheckpoint(i,scx, scy, scz,5.0 );[/color]
                        SetVehicleParamsForPlayer(stealcar,i,1,0);
                    }
                }
            }
            return 1;
        }
On the line case 101:
pawn Код:
{
            for(new i = 0; i <= MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if (!IsPlayerInVehicle(i, stealcar))
                    {
                        SetPlayerCheckpoint(i,scx, scy, scz,5.0 );
                        SetVehicleParamsForPlayer(stealcar,i,1,0);
                    }
                    //SetAllPlayerCheckpoint(scx, scy, scz, 16.0, 255);
                }
            }
            return 1;
        }
4- On public JobGive(playerid)

On the line (MissionActive == 9)
pawn Код:
{
        SendClientMessage(playerid, COLOR_YELLOW, objstore);
        RingTone[playerid] = 20;
        SetVehicleParamsForPlayer(stealcar,playerid,1,0);
            SetPlayerCheckpoint(playerid,scx, scy, scz,5.0 );
        SendClientMessage(playerid, COLOR_WHITE, "HINT: Go To The Yellow Marker And Steal The Car.");
        GameTextForPlayer(playerid, "~w~Nuova Missione ~n~~y~Ruba il Veicolo", 5000, 1);
        return 1;
    }
5- On public LockCar(carid)
pawn Код:
{
    if (gdebug >= 1){printf("DEBUG LockCar(%d)",carid);}
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(stealcar == carid)
            {
                SetVehicleParamsForPlayer(carid,i,1,1);
                    SetPlayerCheckpoint(i,scx, scy, scz,5.0 );
            }
            else
            {
                SetVehicleParamsForPlayer(carid,i,0,1);
                    SetPlayerCheckpoint(i,scx, scy, scz,5.0 );
            }
        }
    }
}
On public OnPlayerExitVehicle(playerid, vehicleid)
pawn Код:
{
    if (gdebug >= 1){printf("DEBUG OnPlayerExitVehicle(%d, %d)", playerid, vehicleid);}
    if (GetPlayerState(playerid) == 1)
    {
        return 1;
    }
    new string[256];
    new ename[MAX_PLAYER_NAME];
    if (vehicleid == stealcar && (MissionActive == 10 || MissionActive == 101))
    {
        GameTextForPlayer(playerid, "~w~Torna indietro e prendi la ~n~~r~Macchina!", 5000, 1);
        for(new i = 0; i <= MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
            SetVehicleParamsForPlayer(stealcar,i,1,0);
                    SetPlayerCheckpoint(i,scx, scy, scz,5.0 );
            }
        }
Under public OnPlayerStateChange(playerid, newstate, oldstate)
pawn Код:
if(gTeamCarLock[newcar] == 1)
        {
            gTeamCarLock[newcar] = 0;
            UnLockCar(newcar);
        }
        gLastCar[playerid] = newcar;
        if (gdebug >=1){printf("gLastCar[playerid](%d)",gLastCar[playerid]);}
        gLastDriver[newcar] = playerid;
        if ((newcar == stealcar) && (MissionActive == 9))
        {
            RewardCalc(playerid,1000,10000);
        }
        if((newcar == stealcar) && (MissionActive >= 9))
        {
            if (gdebug){print("DEBUG TEST3");}
            if (gTeam[playerid] >= 3 && MissionActive >= 9)
            {
                if (gdebug){print("DEBUG TEST4");}
                new name[MAX_PLAYER_NAME];
                new string[256];
                GetPlayerName(playerid, name, sizeof(name));
                GetVehiclePos(stealcardest, cwx, cwy, cwz);
                GameTextForPlayer(playerid, "~w~NOra porta la ~y~Macchina~n~~w~all' ~r~Acquirente", 5000, 1);
                format(string, sizeof(string), "%s Ha rubato una macchina contenente $%d", name,reward);
                BroadCast(COLOR_YELLOW, string);
                SetAllPlayerCheckpoint(cwx, cwy, cwz, 16.0, 0);
                gPlayerCheckpointStatus[playerid] = CHECKPOINT_CARDROP;
                MissionActive = 10;
                if (gdebug){print("DEBUG MissionActive = 10;");}
                if (gTeam[playerid] == 3)
                {
                    SetPlayerCriminal(playerid,255, "Grand Theft Auto",0,0);
                }
                gSuperCop = playerid;
                OpenDoors();
            }
ADD THIS
pawn Код:
if (gTeam[playerid] == 2 && MissionActive >= 9)
            {
                if (gdebug){print("DEBUG TEST6");}
                GameTextForPlayer(playerid, "~w~You are Cop, please Wait other gangs or civilian", 5000, 1);
        RemovePlayerFromVehicle(playerid);
                if (gdebug){print("DEBUG MissionActive = 10;");}
            }
pawn Код:
if (gTeam[playerid] == 2 && MissionActive >= 10)
            {
                if (gdebug){print("DEBUG TEST6");}
                new name[MAX_PLAYER_NAME];
                new string[256];
                GetPlayerName(playerid, name, sizeof(name));
                cwx = 1539.1;
                cwy = -1668.0;
                cwz = 5.8;
                GameTextForPlayer(playerid, "~w~Riporta la ~y~Macchina ~n~~w~al ~r~Punto di incontro", 5000, 1);
                format(string, sizeof(string), "Officer %s Has Seized A Stolen Car Worth $%d", name,reward);
                BroadCast(COLOR_YELLOW, string);
                SetAllPlayerCheckpoint(cwx, cwy, cwz, 16.0, 0);
                gPlayerCheckpointStatus[playerid] = CHECKPOINT_CARDROP;
                gSuperCop = playerid;
                MissionActive = 10;
                if (gdebug){print("DEBUG MissionActive = 10;");}
            }
        }
    }
    if(newstate == PLAYER_STATE_SPAWNED)
Quote:
Originally Posted by juuleman
Посмотреть сообщение
Please add to the main post:

Add this to your script:

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
   if(gCarLock[vehicleid] == 1)
   {
       SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
   }
   return 1;
}
This will fix the /lock bug. Now the cars stay locked fine.
That should be it! Your PENLS should work fine now on SA-MP 0.3 servers.


Original topic: http://forum.sa-mp.com/index.php?topic=40910.0
Reply
#2

GREAT, i needed this!! Thanks for this.

A few questions though:
Do you know how to fix the spawn bug? where when you spawn you see only blue sky? (unless you own a house i believe) or the spawn on last location problem? when after logging off and logging back on you are taken to your last position where you left the game. (unless you own a house)

if you do know how to fix it tell me please.
I've been searching for an answer for like two weeks and tried a few suggestions but they didnt work
Reply
#3

Quote:
Originally Posted by LiQuIdSnAkE
GREAT, i needed this!! Thanks for this.

A few questions though:
Do you know how to fix the spawn bug? where when you spawn you see only blue sky? (unless you own a house i believe) or the spawn on last location problem? when after logging off and logging back on you are taken to your last position where you left the game. (unless you own a house)

if you do know how to fix it tell me please.
I've been searching for an answer for like two weeks and tried a few suggestions but they didnt work
Hey,
1) I believe that interior is problem, try to modify SetPlayerRandomSpawn function, you'll see that PlayerInfo[playerid][pInt] and GetPlayerInterior doesn't match, but it should, try to do
pawn Код:
SetPlayerInterior(playerid,15); // 15 - motel interior
PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
OnUpdatePlayer(playerid);
2) Huh, I don't have issues with that 'last location saving', so I can't help you
Reply
#4

same problem i put it under:
pawn Код:
public SetPlayerRandomSpawn(playerid)
if thats wrong where exactly should i put it ?!?!?
+
i dont get how you didnt have this problem i downloaded 4 different versions of penls and they all spawn me on that blank spot and when i do /setint 0 hes in the sky falling above the motel and dies and then respawns back in the sky to die again o.0 lol

i also tried adding
pawn Код:
SetPlayerInterior(playerid,0);
under public OnPlayerSpawn and it worked but he spawns in the sky o.0
i tried changing the spawn location but it always stays at the motel

i also tried these suggestions :
http://forum.sa-mp.com/index.php?topic=133935.0

and these:
http://forum.sa-mp.com/index.php?topic=128872.0
Reply
#5

some Russian guys made it
Reply
#6

Thank you for destroying our environment on SA-MP.com!!
Now we again get a lot of noobs regarding questions about how to make license system, more houses, etc. at PEN/GF!!
Reply
#7

Quote:
Originally Posted by WackoX
Thank you for destroying our environment on SA-MP.com!!
Now we again get a lot of noobs regarding questions about how to make license system, more houses, etc. at PEN/GF!!
First, you're destroying environment by posting unnecessary posts in this topic.
Second, if someone don't know how to script, he is not noob. Don't insult them.
Third, nobody has invited you here, you just came and posted stupid post.

@LiQuIdSnAkE
Copy and paste your SetPlayerRandomSpawn please.
Reply
#8

Quote:
Originally Posted by nik29
some Russian guys made it
I know its, penls + GTO

I tried to copy it from there but it was in .amx and when I De-amx i get weird defines like
new glob81D64 instead of new string for example and i dont really quite understand that.

pawn Код:
public SetPlayerRandomSpawn(playerid)
{
    new rand;
    new playername[32];
    new house = PlayerInfo[playerid][pPhousekey];
    GetPlayerName(playerid, playername, sizeof(playername));
    if(gPlayerFighter[playerid] == 1)
  {
        new string[256];
        gTeam[playerid] = 4;
        SetPlayerToTeamColor(playerid);
        rand = random(sizeof(gRandomDMSpawns)-2)+1;
        SetPlayerPos(playerid, gRandomDMSpawns[rand][0], gRandomDMSpawns[rand][1], gRandomDMSpawns[rand][2]); // Warp the player
        SetPlayerFacingAngle(playerid, 270.0);
        SetPlayerInterior(playerid,0);
        PlayerInfo[playerid][pInt] = 0;
        format(string, sizeof(string), " ~r~%d~w~|~g~%d",DmScore[playerid],DmHiScore);
        GameTextForPlayer(playerid, string, 5000, 6);
        if(gFightLeader < 1000)
        {
            TogglePlayerControllable(playerid, 0);
        }
        if (gdebug >=0){printf("DEBUG SPAWNED: Playerid:%d Team:%d DMPoint:%d", playerid, gTeam[playerid], rand);}
        return 1;
    }
    if(house !=255)
    {
        /*
        if(gTeam[playerid] <= 2 && strcmp(playername, HouseInfo[house][hOwner], true) == 0 || gTeam[playerid] > 2)
        {
            */

            SetPlayerToTeamColor(playerid);
            SetPlayerInterior(playerid,HouseInfo[house][hInt]);
            SetPlayerPos(playerid, HouseInfo[house][hExitx], HouseInfo[house][hExity],HouseInfo[house][hExitz]); // Warp the player
            PlayerInfo[playerid][pLocal] = house;
            PlayerInfo[playerid][pInt] = HouseInfo[house][hInt];
            if (gdebug >=1){printf("DEBUG SPAWNED: Playerid:%d Team:%d SpawnPoint:%d", playerid, gTeam[playerid], rand);}
            return 1;
        //}

    }
    if ((gTeam[playerid]) == 2)
    {
        SetPlayerToTeamColor(playerid);
        rand = random(sizeof(gCopPlayerSpawns));
        SetPlayerPos(playerid, gCopPlayerSpawns[rand][0], gCopPlayerSpawns[rand][1], gCopPlayerSpawns[rand][2]); // Warp the player
        SetPlayerFacingAngle(playerid, 270.0);
        SetPlayerInterior(playerid,0);
        PlayerInfo[playerid][pInt] = 0;
        if (gdebug >=1){printf("DEBUG SPAWNED: Playerid:%d Team:%d SpawnPoint:%d", playerid, gTeam[playerid], rand);}
        return 1;
  }
  if ((gTeam[playerid]) == 1)
  {
        SetPlayerToTeamColor(playerid);
        rand = random(sizeof(gMedPlayerSpawns));
        SetPlayerPos(playerid, gMedPlayerSpawns[rand][0], gMedPlayerSpawns[rand][1], gMedPlayerSpawns[rand][2]); // Warp the player
        SetPlayerFacingAngle(playerid, 270.0);
        SetPlayerInterior(playerid,0);
        PlayerInfo[playerid][pInt] = 0;
        if (gdebug >=1){printf("DEBUG SPAWNED: Playerid:%d Team:%d SpawnPoint:%d", playerid, gTeam[playerid], rand);}
        return 1;
    }
  else
  {
        SetPlayerToTeamColor(playerid);
        rand = random(sizeof(gRandomPlayerSpawns));
        SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]); // Warp the player
        SetPlayerFacingAngle(playerid, 270.0);
        SetPlayerInterior(playerid,15);
        PlayerInfo[playerid][pInt] = 0;
        if (gdebug >=1){printf("DEBUG SPAWNED: Playerid:%d Team:%d SpawnPoint:%d", playerid, gTeam[playerid], rand);}
        return 1;
    }
//  return 1;
}
Its the original Penls. I have all my other additions on a separate file so theres nothing i did to it that changed anything.

And by the way, my question is regarding the topic name on how to convert Penls to 0.3. It's Not a general inquiry on how to make houses and such. I don't see how he ruined the environment, its more like helping.

Reply
#9

Nie one luka

Another penls bug is that hotwire mission dont works it can be fixed with by using checkpoint
Reply
#10

Add This (by me)

Код:
public OnPlayerSpawn(playerid)
{
	if (gdebug >=1){printf("OnPlayerSpawn Playerid:%d", playerid);}
	new playername[40];
	if (teamcarlock)
	{
		TeamLockDoors(playerid);
	}
	InitLockDoors(playerid);
	if(accountplay)
	{
		if (gdebug >=1){printf("accountplay");}
		if (gPlayerAccount[playerid] == 0)
		{
			gTeam[playerid] = 0;
			GameTextForPlayer(playerid, "~w~Welcome.~n~In order to play you need to create an account, type ~n~~r~/regnick (password)~w~ to register", 20000, 3);
			//SetPlayerInterior(playerid,0);
			SetPlayerInterior(playerid,3);
			PlayerInfo[playerid][pInt] = 3;
			SetPlayerPos(playerid,198.5,162.5,1003.0);
			// airport
			PlayJailSound(1153 , 1154, 2000,264.395200, 77.564040, 1001.039000);
			gPlayerSpawned[playerid] = 1;
  		return 1;
		}
		if (gPlayerLogged[playerid] == 0)
		{
			gTeam[playerid] = 0;
			GameTextForPlayer(playerid, "~w~In order to play you need to log in to your account, type ~n~~g~/login (password)~w~ to log in", 20000, 3);
			//SetPlayerInterior(playerid,0);
			SetPlayerInterior(playerid,3);
			PlayerInfo[playerid][pInt] = 3;
			SetPlayerPos(playerid,198.5,162.5,1003.0);
			// airport
			PlayJailSound(1153 , 1154, 2000,264.395200, 77.564040, 1001.039000);
			gPlayerSpawned[playerid] = 1;
  		return 1;
		}
	}
if (gPlayerSpawned[playerid] == 1)
	{
		gTeam[playerid] = PlayerInfo[playerid][pTeam];
		if (gTeam[playerid] == 2 && forceteam && CopCheck(playerid))
		{
			gTeam[playerid] = 3;
			PlayerInfo[playerid][pTeam] = 3;
			SetPlayerRandomSpawn(playerid);
			SendClientMessage(playerid, COLOR_YELLOW, "SERVER: Your are not allowed to be a cop.");
		}
Edit if (gPlayerSpawned[playerid] == 1) Change 0 to 1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)