[Tutorial] [TUT] How to add a player Into your script.
#1

Well To start off, To them people who don't know me... I'm Wasim_Cortez and today ill show you how to add a player into your script.


To start off, Open up Pawno and click new.

Now look for "AddPlayerClass"

When you have found that... Read the following information:

What is this line Used for?
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
This line is used for adding players into your script/Server:
The Meaning of that line is:
AddPlayerClass(Player model, X, Y, Z, A, Weapon 0, Ammo 0, Weapon 1, Ammo 1, Weapon 2, Ammo 2);
Infomation about the script line:
Player model
The player Model, Is the players skin ID. To use a Rich means skin, Use skin ID=59.
To use a Sureno gang banger skin, Use skin ID=175.
So if you wanted to use a rich man skin you would have your code like this:
AddPlayerClass(59, X, Y, Z, A, Weapon 0, Ammo 0, Weapon 1, Ammo 1, Weapon 2, Ammo 2);
X,Y,Z,A
X Y Z Are the Coords Aka Coordinates, This tells the script when the person picks his player, To spawn that player were the coords were set to.
The A is the facing angle of the player, So if you want your player to be facing somewere, Use this.
Soo, If you wanted the player to start at Unity Station and want him to have a rich man skin, You would have this:
AddPlayerClass(59,1799.7964,-1867.6007,13.5700,347.3619,Weapon 0, Ammo 0, Weapon 1, Ammo 1, Weapon 2, Ammo 2);
Weapon 0-2 And Ammo 0-2
Weapon is the weapon that the player gets when he spawns. Weapon ID=24 Is an Deagle And Weapon ID 30 Is an AK-47.
Ammo is the bullets that the weapon has. So if you want a player to start a Unity station with a rich man skin and an AK-47
With 300 bullets you would put in this:
AddPlayerClass(59,1799.7964,-1867.6007,13.5700,347.3619,30, 300, 0, 0, 0, 0);
Reminder: If you want a player with no weapon, Just put a 0 for the Weapon and put a 0 for the ammo.

Ok, That tells us what the script line means. Now lets tell you how to get Coords.
Open up your GTA:SA Folder and there should be something called "samp_debug.exe". Ok, Open it up.
You should see that GTA:SA started with nothing Only Cj running around with no weapons.

Now go to the place were you want your player to start, Then Press "T' Or 'F6' to type in the command "/save".
HINT:Next to save you can wirte something that would let your rember that you just saved so do this:
/save New Player Spawn.
Ok, Now you have saved the place were you want the player to start. Now got into your GTA:SA folder and there should be something named:
"Savedpositions.Txt"
Open that up and you have the Coords of were you want your player to start, All you have to do now is copy the X Y Z and A from the "Savedpositions.Txt"
file and just replace it with the one you have on your script.


So there you go, You made your first player in your script with a gun.



By:Wasim_Cortez Aka Clippah/Luckiie
Reply
#2

' Just to start off ' it's more likely a Class/Ped/Character than a ' Player '. Players = US people, that skin/ped shouldn't be count as a Player :P
Anyways, good tut for newbies however most of them (newbies) already know that kinda stuff. ALSO there's already a tutorial on wiki, better explained. Anyways good job.
Reply
#3

Thanks I just wanted to do this because i was sick of scripting for the day lols

Reply
#4

Nice Idea
Reply
#5

idealogy seems good.. But this is kind of basic stuff, I guess people just cant be bothered to do all the needed reading these days.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)