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

Today I will show you how to add a skin to 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?
pawn Код:
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
This line is used for adding ped's into your script/Server:
The Meaning of that line is:
pawn Код:
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:
pawn Код:
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:
pawn Код:
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.
Reply
#2

It's really good that you're taking an initiative by trying to write a tutorial, but this is sort of wrong.

Adding a player doesn't really make sense - It should be adding class/skin options in selection screen

The tutorial is very untidy, and use [pawn] code and // for writing functions that are in PAWN

Explain more, and next time you write a tutorial, take a better topic.
Reply
#3

By saying player,i mean a type of skin!
Anyway,thanks for the opinion!
Reply
#4

Well done!
Reply
#5

Quote:
Originally Posted by CreativityLacker
Посмотреть сообщение
It's really good that you're taking an initiative by trying to write a tutorial, but this is sort of wrong.

Adding a player doesn't really make sense - It should be adding class/skin options in selection screen

The tutorial is very untidy, and use [pawn] code and // for writing functions that are in PAWN

Explain more, and next time you write a tutorial, take a better topic.
Made all the changes!
Reply
#6

Good tutorial but here is already on the wiki.
https://sampwiki.blast.hk/wiki/AddPlayerClass
Reply
#7

Nice tutorial, well explained.
Reply
#8

Quote:
Originally Posted by Pettersen
Посмотреть сообщение
Good tutorial but here is already on the wiki.
https://sampwiki.blast.hk/wiki/AddPlayerClass
Tutorials are here to explain more than a wiki does, when I had no clue on how to script and looked at the wiki, I didn't understand a single word from it, by players their tutorials it makes clear on how you exactly do everything.

Nice tutorial, maybe for the next time a little bit better customizing your text and not making everything bold, and it was kinda a misleading title though.
Reply
#9

Thanks guys!
And surely,I will improve the new posts and tutorials I make in future!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)