SA-MP Forums Archive
New scripting Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: New scripting Help (/showthread.php?tid=72237)



New scripting Help - kimse007 - 07.04.2009

Hello there..

I am currently trying to learn PAWN. Until now I have learnt the basic I think(Iґll show what I have scripted later). My next step is to make a faction. I have went through GF and PEN1 but I canґt find the exactly way to do it in. So if anybody can post a link or can show how to make a simpel faction with 2 ranks and explain deeply what you did, I would appreciate that.

The next thing is removing the currently doors. I can see there is a door at CJ house in grove st. and at the police station. How do I remove these?

The thing is: How do I do it like when a player enter a certain area, he can do /enter and heґll get in to a default interior. (If you can explain that deeply too, it would be great).

I have searched wiki thin, and I couldnґt find exactly what I was looking for. So I hope some of you can help me.

Thank you in advance
Kim

oh yeah and what I have scripted until now: http://pastebin.com/f52447935



Re: New scripting Help - NeRoSiS - 07.04.2009

DisableInteriorEnterExits();

When you say doors do you mean the yellow markers? If so, that removes them ^

http://forum.sa-mp.com/index.php?topic=87145.0
Tutorial on doing /enter's

It doesn't give you the link for interior's, so heres the wiki page : https://sampwiki.blast.hk/wiki/InteriorIDs

Hope I could help


Re: New scripting Help - kimse007 - 07.04.2009

aah yeah thanks man.. I really appreciate your help

BTW I already got the interior ID page :P


Re: New scripting Help - NeRoSiS - 07.04.2009

Lol, no problem, took me a while to zoom in on that, TIME WASTER!!! Jokes xd

Have fun


Re: New scripting Help - 13th - 07.04.2009

Quote:
Originally Posted by kimse007
Hello there..

I am currently trying to learn PAWN. Until now I have learnt the basic I think(Iґll show what I have scripted later). My next step is to make a faction. I have went through GF and PEN1 but I canґt find the exactly way to do it in. So if anybody can post a link or can show how to make a simpel faction with 2 ranks and explain deeply what you did, I would appreciate that.
Well, you always need to slice up your end-goal into smaller pieces. In this way you get a clearer look on what you need to actually do and how to do it. So, what do you need for a faction?

First you need to find a way to seperate faction players from another. That can be done with enum and array. It is very comfortable to use and you can save all player specific data in one place. Read more about it from here - About Enums.

Once you can tell difference between player in faction and regular player ( if( PlayerInfo[playerid][Faction] == 1 ) ..... ) you can start adding other stuff.

For example to create a faction vehicle you could do:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if( PlayerInfo[playerid][Faction] != 1 && vehicleid == FactionCar )
	{
	  RemovePlayerFromVehicle(playerid);
	  SendClientMessage(playerid, COLOR_WHITE, "This is a faction car!");
	}
	return 1;
}
If you want to create many factions and cars to them it would be sensible to create a enum for cars also. So you could do something like:
Код:
new vehicleid = CreateVehicle(...);
VehicleInfo[factioncar][FactionCar] = 1;
...
...
...

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if( VehicleInfo[vehicleid][FactionCar] )
	{
		if( PlayerInfo[playerid][Faction] != VehicleInfo[vehicleid][FactionCar] )
		{
		  RemovePlayerFromVehicle(playerid);
		  SendClientMessage(playerid, COLOR_WHITE, "This is a faction car!");
		}
	}
	return 1;
}
It is easy really. Family chat for example, just SendClientMessage to everybody who has PlayerInfo[playerid][Faction] same as the person who wrote the message.

Adding ranks is just the same. Like adding another faction in the faction. Add "FactionRank" to PlayerInfo and "CarRank" to vehicleinfo .Now for ranked faction vehicle for example you could do something like
Код:
new vehicleid = CreateVehicle(...);
VehicleInfo[factioncar][FactionCar] = 1;
...
...
...

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if( VehicleInfo[vehicleid][FactionCar] )
	{
		if( PlayerInfo[playerid][Faction] == VehicleInfo[vehicleid][FactionCar] && PlayerInfo[playerid][FactionRank] >= VehicleInfo[vehicleid][CarRank] )
		{
		  SendClientMessage(playerid, COLOR_WHITE, "Welcome to your faction car!");
		}
		else
		{
		  RemovePlayerFromVehicle(playerid);
		  SendClientMessage(playerid, COLOR_WHITE, "You are not allowed to use this vehicle!");
		}
	}
	return 1;
}
As for entrances to interiors - There is a function "PlayerToPoint", under command /enter check if player is at point where you want the entrance to be. If he is place him into interior with SetPlayerPos and SetPlayerInterior. Same thing with exit (you can do all under one command with "else if"). If you want to use same interior for more than one place you also need to use SetPlayerVirtualWorld and on exiting check the virtual world and teleport player back to correct position.