[Tutorial] Don't have a site?
#1

Hi this tutorial is a simple tutorial all it is , is that you can receive messages from in-game to your scriptfiles.
So lets say you don't have a site or can't afford one or don't want a ugly free one...
You can create a command which lets your players report bugs and suggest suggestions from in-game.
You need Zcmd for this.
Quote:

CMD:feedback(playerid, params[])
{
if (isnull(params)) return SendClientMessage(playerid,-1,# /feedback <feedback> Thank You.);//This is if the player does not type any feedback and only does /feedback

new
_msg[ 128 ],
_msg2[ 128 ],
player_name[ MAX_PLAYER_NAME ];

GetPlayerName(playerid, player_name, MAX_PLAYER_NAME);
SendClientMessage(playerid,red,"The feedback you have given has gone through to the main office!");//This is to tell the player that there feedback has gone through

format( _msg, sizeof ( _msg ), "Name: %s\r\n", player_name);
format( _msg2, sizeof( _msg2), "Feedback: %s\r\n",params);

new File: fileToWrite = fopen("Feedback.txt", io_append);//Feedback.txt is were all the feedback will go from your players.(It could get spammed -_-)
fwrite(fileToWrite,"[New Feedback]\r\n");//Everytime a player types a new suggestion it will type [New Feedback] Underneath the other feedback.
fwrite(fileToWrite, _msg);
fwrite(fileToWrite, _msg2);
fclose(fileToWrite);
return 1;
}

This is how it will look when you open Feedback.txt

[New Feedback]
Name: Randomdude
Bug: Test


So lets say you wanted to change this command to something of your own like report bugs this is how you would do it.
Quote:

CMD:feedback(playerid, params[]) //You would change feedback to the command you would like it to so like CMD:reportbug
{
if (isnull(params)) return SendClientMessage(playerid,-1,# /feedback <feedback> Thank You.);//You would also change this from "# /feedback <feedback> Thank You." To "# /reportbug <bug/bug's> Thank You."

new
_msg[ 128 ],
_msg2[ 128 ],
player_name[ MAX_PLAYER_NAME ];

GetPlayerName(playerid, player_name, MAX_PLAYER_NAME);
SendClientMessage(playerid,red,"The feedback you have given has gone through to the main office!");//You would change the clientmessage to something like "The Bug Has Been Reported.".

format( _msg, sizeof ( _msg ), "Name: %s\r\n", player_name);
format( _msg2, sizeof( _msg2), "Feedback: %s\r\n",params); //Change "Feedback" to "Bug"

new File: fileToWrite = fopen("Feedback.txt", io_append);//Change this from "Feedback.txt" to "Bug Reports.txt"
fwrite(fileToWrite,"[New Feedback]\r\n");//Change "[New Feedback]" to "[New Bug Report]"
fwrite(fileToWrite, _msg);
fwrite(fileToWrite, _msg2);
fclose(fileToWrite);
return 1;
}

If you did all that it would look more like this in the Bug Reports.txt file.

[New Bug Report]
Name: RandomDude.
Bug: Test

Thanks for reading my simple tutorial if there are any mistakes you are free to correct me
This is my first tutorial
If you want you can give me feedback on what I can improve on next time
Thanks!
Reply
#2



https://sampforum.blast.hk/showthread.php?tid=65567
Reply
#3

Quote:
Originally Posted by RealCop228
View Post
Its for newbies mainly -_-
I'm sure they can understand
Reply
#4

And then some faggot decides to spam the command and you will have gigabytes of logs files. That, or your server just crashes.
Reply
#5

Quote:
Originally Posted by Vince
View Post
And then some faggot decides to spam the command and you will have gigabytes of logs files. That, or your server just crashes.
Very true if somebody spams that command it will just become a huge file 100.GB lol
Reply
#6

Quote:
Originally Posted by Vince
View Post
And then some faggot decides to spam the command and you will have gigabytes of logs files. That, or your server just crashes.
what about the timer !!
Reply
#7

Quote:
Originally Posted by Vince
View Post
And then some faggot decides to spam the command and you will have gigabytes of logs files. That, or your server just crashes.
Yes I know.. I did type that in the tutorial like I said if you want to add a time you may do please yourself
Reply
#8

Poorly made, doesn't explain much, newbies won't get it, use [ pawn ] tags, try to use / learn multidimensional arrays e.g new string[2][128];
Reply
#9

Quote:
Originally Posted by thefatshizms
View Post
Poorly made, doesn't explain much, newbies won't get it, use [ pawn ] tags, try to use / learn multidimensional arrays e.g new string[2][128];
Okay thanks for the feedback bro.
Reply
#10

Quote:
Originally Posted by RealCop228
View Post
Quote:
Originally Posted by Vince
View Post
And then some faggot decides to spam the command and you will have gigabytes of logs files. That, or your server just crashes.
Quote:
Originally Posted by thefatshizms
View Post
Poorly made, doesn't explain much, newbies won't get it, use [ pawn ] tags, try to use / learn multidimensional arrays e.g new string[2][128];
All this, try to format the post neater too, will make it easier to read. Also the thread title is a little misleading.
Reply
#11

Quote:
Originally Posted by Bicentric
View Post
All this, try to format the post neater too, will make it easier to read. Also the thread title is a little misleading.
Yes I understand I'm taking in the feedback -_- Its my first tutorial if I do make another one I will use this feedback
Reply
#12

Any way ... i dont care what other say i will say + support and keep it up
Reply
#13

Quote:
Originally Posted by M3mPHi$_S3
View Post
Any way ... i dont care what other say i will say + support and keep it up
Thank you very much dude!
Reply
#14

I thought this was a very good tutorial, i've only been scripting for a few days and this has made making my server alot easier +1
Reply
#15

The tutorial is pretty good, although I'd suggest you use [pawn] next time.
Reply
#16

Quote:
Originally Posted by mahony0509
View Post
I thought this was a very good tutorial, i've only been scripting for a few days and this has made making my server alot easier +1
Your welcome and thanks
Quote:
Originally Posted by Syntax
View Post
The tutorial is pretty good, although I'd suggest you use [pawn] next time.
Yup next time I will
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)