[Help] Beginner Help
#1

Hello there,
I am new at this forums and on scripting too. So about my experience, I know python basics ONLY. But I want to learn pawno and for now, I know basics like how to create /heal /tpto etc. I watched almost every video on youtube about tuts. But I want to learn advance. attach some links or help me. Just think I am totally nub, idk anything
Reply
#2

Well for start (assuming you know how to include includes) I want you to download and include these 2 includes / plugins in your gamemode..

sscanf: https://sampforum.blast.hk/showthread.php?tid=570927
Pawn.CMD: https://sampforum.blast.hk/showthread.php?tid=608474

With these 2 plugins you can create commands.. Here's example

Code:
CMD:heal(playerid, params[]) // In this case you will have to type /heal in game for this command to work.
{
	new string[128], pID, Float:Health; //We will create a new variable "pID" which will define which player id we want to heal, float variable (tag) to store player's health in and name it "Health" and "string" to format it later and sent formatted messages.
	if(sscanf(params, "d", pID)) return SendClientMessage(playerid, -1, "USAGE: /heal (playerid)"); //Using "sscanf" we can check if player type "/heal" in chat, this message will pop out, letting him know he has to use /heal (playerid).
	if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "That player is not connected."); //Using "!IsPlayerConnected" we check if player (playerid) we are trying to heal is even connected, if not, this message will be sent and command will not be executed.
	GetPlayerHealth(pID, Health); //Thats the function to get player's health	
	if(Health == 100) return SendClientMessage(playerid, -1, "Player is already full Health."); //With this, we check if player's health is 100, that means he doesnt need to be healed and.
	SetPlayerHealth(pID, 100.0);
	
	format(string, sizeof(string), "You have healed %s (%d).", PlayerName(pID), pID); //Formatting the message, you can checke the specifiers we use in this case on sscanf website I linked above.
	SendClientMessage(playerid, -1, string); //Sending message
	
	format(string, sizeof(string), "You have been healed by %s.", PlayerName(playerid)); //Formatting the message, you can checke the specifiers we use in this case on sscanf website I linked above.
	SendClientMessage(pID, -1, string); //Sending message
	return 1;
}

PlayerName(playerid)
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	return name;
}
Might be complicated, but try to read the command through, and then go through "Pawn.CMD" and "sscanf" websites I linked above, and you will being to understand how it works.

Behind "//" (comment) I specified what each line does.
Reply
#3

First of all, the language is Pawn and not pawno (pawno is an editor, which uses pawncc as compiler).

You may want to start with this one: https://github.com/compuphase/pawn/b...uage_Guide.pdf
Make sure you read this one aswell: https://sampwiki.blast.hk/wiki/Scripting_Basics

These tutorials I find pretty important aswell (especially the arrays one):
https://sampforum.blast.hk/showthread.php?pid=876854#pid876854
https://sampforum.blast.hk/showthread.php?tid=318212

Apart from that you should just download scripts on the forums here and look into them and try to understand what it does. Then start creating your own stuff. Just play around with coding a bit and see what it does during runtime (tip: Use alot of debugging messages -It tells you exactly what is happening -or not if it does not pop up).

Also you might wanna check out the YSI library (look it up).
Reply
#4

Quote:
Originally Posted by NoteND
View Post
Well for start (assuming you know how to include includes) I want you to download and include these 2 includes / plugins in your gamemode..

sscanf: https://sampforum.blast.hk/showthread.php?tid=570927
Pawn.CMD: https://sampforum.blast.hk/showthread.php?tid=608474

With these 2 plugins you can create commands.. Here's example

Code:
CMD:heal(playerid, params[]) // In this case you will have to type /heal in game for this command to work.
{
	new string[128], pID, Float:Health; //We will create a new variable "pID" which will define which player id we want to heal, float variable (tag) to store player's health in and name it "Health" and "string" to format it later and sent formatted messages.
	if(sscanf(params, "d", pID)) return SendClientMessage(playerid, -1, "USAGE: /heal (playerid)"); //Using "sscanf" we can check if player type "/heal" in chat, this message will pop out, letting him know he has to use /heal (playerid).
	if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "That player is not connected."); //Using "!IsPlayerConnected" we check if player (playerid) we are trying to heal is even connected, if not, this message will be sent and command will not be executed.
	GetPlayerHealth(pID, Health); //Thats the function to get player's health	
	if(Health == 100) return SendClientMessage(playerid, -1, "Player is already full Health."); //With this, we check if player's health is 100, that means he doesnt need to be healed and.
	SetPlayerHealth(pID, 100.0);
	
	format(string, sizeof(string), "You have healed %s (%d).", PlayerName(pID), pID); //Formatting the message, you can checke the specifiers we use in this case on sscanf website I linked above.
	SendClientMessage(playerid, -1, string); //Sending message
	
	format(string, sizeof(string), "You have been healed by %s.", PlayerName(playerid)); //Formatting the message, you can checke the specifiers we use in this case on sscanf website I linked above.
	SendClientMessage(pID, -1, string); //Sending message
	return 1;
}

PlayerName(playerid)
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	return name;
}
Might be complicated, but try to read the command through, and then go through "Pawn.CMD" and "sscanf" websites I linked above, and you will being to understand how it works.

Behind "//" (comment) I specified what each line does.
Thanks for the help, but can you tell me what did %s %d do? I mean what does the line mean (format,sizeof string) what is sizeof string string? Can you explain that briefly?
Because i can create this command, but not like this and i wanna know like this.
Thanks.
Reply
#5

Quote:
Originally Posted by Kwarde
View Post
First of all, the language is Pawn and not pawno (pawno is an editor, which uses pawncc as compiler).

You may want to start with this one: https://github.com/compuphase/pawn/b...uage_Guide.pdf
Make sure you read this one aswell: https://sampwiki.blast.hk/wiki/Scripting_Basics

These tutorials I find pretty important aswell (especially the arrays one):
https://sampforum.blast.hk/showthread.php?pid=876854#pid876854
https://sampforum.blast.hk/showthread.php?tid=318212

Apart from that you should just download scripts on the forums here and look into them and try to understand what it does. Then start creating your own stuff. Just play around with coding a bit and see what it does during runtime (tip: Use alot of debugging messages -It tells you exactly what is happening -or not if it does not pop up).

Also you might wanna check out the YSI library (look it up).
Thanks lemme look it..
Reply
#6

Quote:
Originally Posted by LaKhWaN
View Post
Thanks for the help, but can you tell me what did %s %d do? I mean what does the line mean (format,sizeof string) what is sizeof string string? Can you explain that briefly?
Because i can create this command, but not like this and i wanna know like this.
Thanks.
%s and %d are format specifiers. s for strings, d for decimals, i for integers, f for floats etcetera.
More information on format() and the format specifiers here: https://sampwiki.blast.hk/wiki/Format

Sometimes you may need to format a string (array) with some information that does not have a static value (eg. a player's name). The script itself once compiled does not change. Therefor you'll need functions like format() to manipulate an array during runtime.

If you have questions about a function, navigate to https://sampwiki.blast.hk/wiki/FUNCTION_NAME -Note that it is case sensitive (the function name) except for the first characters.
The wiki describes allmost all functions, what they do, and how they work (parameters usage and an example).
Reply
#7

Quote:
Originally Posted by Kwarde
View Post
First of all, the language is Pawn and not pawno (pawno is an editor, which uses pawncc as compiler).

You may want to start with this one: https://github.com/compuphase/pawn/b...uage_Guide.pdf
Make sure you read this one aswell: https://sampwiki.blast.hk/wiki/Scripting_Basics

These tutorials I find pretty important aswell (especially the arrays one):
https://sampforum.blast.hk/showthread.php?pid=876854#pid876854
https://sampforum.blast.hk/showthread.php?tid=318212

Apart from that you should just download scripts on the forums here and look into them and try to understand what it does. Then start creating your own stuff. Just play around with coding a bit and see what it does during runtime (tip: Use alot of debugging messages -It tells you exactly what is happening -or not if it does not pop up).

Also you might wanna check out the YSI library (look it up).
Thanks, I read all the threads, excepts that big pdf... If its really important tell me I will read it too..
Also if any video available tell me. I really want to learn pawn language.
Reply
#8

Quote:
Originally Posted by LaKhWaN
View Post
I read all the threads, excepts that big pdf...
I really want to learn pawn language.
That big pdf is the official pawn language guide from the creators of the language. If you really want to learn pawn, that is the perfect document to start with.
Reply
#9

Others? Please help me I literally want to learn the language pawn. Please I want help from everyone.
Reply
#10

Not everyone can reply to this thread bro, and why do you want to ask from EVERYONE xd ?
All are going to give you the same exact answer. The thing is, logic is more important than the syntax, you can learn the syntax but you need logic.
I will say, first read the pdf. I know its pain ... to read a pdf .. for me tbh but yea do it. Then see the Tutorials on the forum here. And download different gamemodes and then Check how they are scripted, and learn the logic of things how they work.
Everyone will tell u to do this..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)