Few questions about scripting PAWN
#1

I'm considering about learning the PAWN language by scripting for SAMP, but it seems quite hard for me.
Should I learn something easier like C+(heard it was easy so lol) or is PAWN a good start?
If so, I'm considering of downloading an already made gamemode and editing it, what gamemode do you recommend? is zGaming a good start?

EDIT: ok fuk found https://sampforum.blast.hk/showthread.php?tid=397509 right after posting this(ty potassium)
Reply
#2

Whoever said C++ is easier is a complete retard and has never ever programmed real C++ applications. PAWN is relatively flat, while C++ is objects oriented, it is very low level, memory management is a pain if you don't know what you're doing etc.


Anyhow, my way of learning is simple. Try and make a simple gamemode. If you want a specific feature in, let's say a car falls on top of you if you die, then think logically and split it up in smaller parts.
How do I know if a player died? *checks new.pwn and wiki* Ohh, there's a callback "OnPlayerDeath", that gets called when a player dies. Okay, got that. How to spawn a car. *checks wiki* Ohh, cool, CreateVehicle. Etc.

In short, learn by doing.
Reply
#3

Quote:
Originally Posted by Infinity
Посмотреть сообщение
Whoever said C++ is easier is a complete retard and has never ever programmed real C++ applications. PAWN is relatively flat, while C++ is objects oriented, it is very low level, memory management is a pain if you don't know what you're doing etc.


Anyhow, my way of learning is simple. Try and make a simple gamemode. If you want a specific feature in, let's say a car falls on top of you if you die, then think logically and split it up in smaller parts.
How do I know if a player died? *checks new.pwn and wiki* Ohh, there's a callback "OnPlayerDeath", that gets called when a player dies. Okay, got that. How to spawn a car. *checks wiki* Ohh, cool, CreateVehicle. Etc.

In short, learn by doing.
Thanks for your reply, made some sense into me. Pretty sure I heard it over another forum.
However I prefer using a base script and editing the lines, I guess it's all just personal preference!
Reply
#4

View sftdm.pwn and grandlarc.pwn and lvdm.pwn, maybe a good start. Also, give this a go.
Reply
#5

Quote:
Originally Posted by iFarbod
Посмотреть сообщение
View sftdm.pwn and grandlarc.pwn and lvdm.pwn, maybe a good start. Also, give this a go.
Ah thanks for the tutorials list, and I checked grandlarc already, not sure about lvdm/sftdm but I'll go for it!
Reply
#6

Try to make simple modes with a few functions. For example:

pawn Код:
#include <a_samp>

main(){print("My First GM Loaded!");}

public OnGameModeInit()
{
   AddPlayerClassEx(0, 105, 2488.562, -1666.865, 12.8757, 262.0, 24, 150, 29, 300, 4, 1);
   AddPlayerClassEx(1, 102, 2488.562, -1666.865, 12.8757, 262.0, 25, 150, 28, 500, 22, 150);
   return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetCameraBehindPlayer(playerid);
    switch(classid)
    {
        case 0: GameTextForPlayer(playerid, "~g~~h~~h~Grove Street Families", 3000, 4);
        case 1: GameTextForPlayer(playerid, "~p~Ballas", 3000, 4);
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by iFarbod
Посмотреть сообщение
Try to make simple modes with a few functions. For example:

pawn Код:
#include <a_samp>

main(){print("My First GM Loaded!");}

public OnGameModeInit()
{
   AddPlayerClassEx(0, 105, 2488.562, -1666.865, 12.8757, 262.0, 24, 150, 29, 300, 4, 1);
   AddPlayerClassEx(1, 102, 2488.562, -1666.865, 12.8757, 262.0, 25, 150, 28, 500, 22, 150);
   return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetCameraBehindPlayer(playerid);
    switch(classid)
    {
        case 0: GameTextForPlayer(playerid, "~g~~h~~h~Grove Street Families", 3000, 4);
        case 1: GameTextForPlayer(playerid, "~p~Ballas", 3000, 4);
    }
    return 1;
}
Yeap, I made something like that, but never knew of the SetPlayerClassEx, I've been using SetPlayerClass for a while now. Also thanks for the OnPlayerRequestClass >> 'GameTextForPlayer' never knew about that one as well!

I suppose I won't be needing much help now, I'll probably continue this Saturday. I'll let you know if I need any help iFarbod, you've been helpful to me
Reply
#8

Quote:
Originally Posted by FlawPaw
Посмотреть сообщение
Yeap, I made something like that, but never knew of the SetPlayerClassEx, I've been using SetPlayerClass for a while now. Also thanks for the OnPlayerRequestClass >> 'GameTextForPlayer' never knew about that one as well!

I suppose I won't be needing much help now, I'll probably continue this Saturday. I'll let you know if I need any help iFarbod, you've been helpful to me
Difference between AddPlayerClass and AddPlayerClassEx is just this: In AddPlayerClassEx you can assign 'teamid' to that class, also.

I've used this snippet (+KillFeed and a /kill command to change class ) and started a server (on sa-mp.gs) in 2013, first hour i got 13 players!
Reply
#9

Quote:
Originally Posted by iFarbod
Посмотреть сообщение
Difference between AddPlayerClass and AddPlayerClassEx is just this: In AddPlayerClassEx you can assign 'teamid' to that class, also.

I've used this snippet (+KillFeed and a /kill command to change class ) and started a server (on sa-mp.gs) in 2013, first hour i got 13 players!
That's pretty impressive! What happened to the server? Are you still running it?
Reply
#10

No, destroyed 3 months ago, with player base of 35-50, (Host Node fucked up with DDoS attacks and Hoster stopped giving services). I Don't wanna advertise, but i'm currently working on a serious gamemode.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)