Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Tutorial] [SA:MP] Convert Public Enemy to 0.3 & PEN1 Questions

Joined
Mar 5, 2010
Messages
16
Reaction score
3
Adapted directly from the original thread in the SA:MP forums - all credits go to the original makers, I'm just sharing this with the community. I do NOT (look it's in bold for you, say "usefull poop" one more time and there will be hell to pay) take credit for this release.


[size=13pt][HowTo] Convert Public Enemy LS to 0.3[/size]
Feel free to post how to fix something :mrgreen:​
Hello!
Today I was downloaded , 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 scodeed I was in house. That is not usual because you shall scode 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
Code:
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 scodes 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
Code:
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 author=AndryXoX link=topic=157193.msg936602#msg936602 date=1267894274]
Add This (by me)

Code:
public OnPlayerScode(playerid)
{
	if (gdebug >=1){printf("OnPlayerScode 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);
			gPlayerScodeed[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);
			gPlayerScodeed[playerid] = 1;
    		return 1;
		}
	}
if (gPlayerScodeed[playerid] == 1)
	{
		gTeam[playerid] = PlayerInfo[playerid][pTeam];
		if (gTeam[playerid] == 2 && forceteam && CopCheck(playerid))
		{
			gTeam[playerid] = 3;
			PlayerInfo[playerid][pTeam] = 3;
			SetPlayerRandomScode(playerid);
			SendClientMessage(playerid, COLOR_YELLOW, "SERVER: Your are not allowed to be a cop.");
		}


Edit if (gPlayerScodeed[playerid] == 1) Change 0 to 1 :D :D :D
[/quote]

Now follow those instructions (all credits to AndryXoX)
[quote author=AndryXoX link=topic=157193.msg939535#msg939535 date=1268064660]
To correct the mission HotWire (checkpoints)
replace and/or add
Code:
SetVehicleParamsForPlayer(stealcar,i,1,0);
SetPlayerCheckpoint(i,scx, scy, scz,5.0 );

1- On public OnPlayerScode(playerid)

Remove first /* switch (MissionActive) }/*
On the line case 9://Car is waiting first occupent
Code:
{
				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()

Code:
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 );
						SetVehicleToRescode(stealcar);
						stealcar = -1;
					}

3- Under public SetPlayerNewMission()

On the line case 8:
Code:
{
			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) && (gPlayerScodeed[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:
Code:
	{
			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:
Code:
{
			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)
Code:
{
		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)
Code:
{
	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)
Code:
{
	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)
Code:
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();
			}
[size=20pt]ADD THIS[/size]
Code:
		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;");}
			}

Code:
	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_ScodeED)
[/quote]

That should be it! Your PENLS should work fine now on SA-MP 0.3 servers.


Original topic:
 
Last edited:
Initiate Mage
Joined
Jul 14, 2015
Messages
1
Reaction score
0
Can you upload the Modified PENLS on SA-MP 0.3 Servers because I'm very busy right now, please :D:
Sorry if reply this in this year because this thread is old and I'm bad english

Regards
 
Back
Top