SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 17/04/2013, 04:53 PM   #1
RandomDude
Huge Clucker
 
Join Date: Jun 2011
Location: Behind You
Posts: 390
Reputation: 0
Lightbulb Don't have a site?

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!
RandomDude is offline   Reply With Quote
Old 17/04/2013, 04:59 PM   #2
Scenario
Godfather
 
Scenario's Avatar
 
Join Date: Feb 2010
Location: Heaven
Posts: 7,801
Reputation: 701
Default Re: Don't have a site?



http://forum.sa-mp.com/showthread.php?t=65567
Scenario is offline   Reply With Quote
Old 17/04/2013, 05:03 PM   #3
RandomDude
Huge Clucker
 
Join Date: Jun 2011
Location: Behind You
Posts: 390
Reputation: 0
Default Re: Don't have a site?

Quote:
Originally Posted by RealCop228 View Post
Its for newbies mainly -_-
I'm sure they can understand
RandomDude is offline   Reply With Quote
Old 17/04/2013, 07:07 PM   #4
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,066
Reputation: 2660
Default Re: Don't have a site?

And then some faggot decides to spam the command and you will have gigabytes of logs files. That, or your server just crashes.
__________________
Vince is offline   Reply With Quote
Old 18/04/2013, 01:07 AM   #5
Yves
High-roller
 
Yves's Avatar
 
Join Date: Feb 2013
Location: Area 51
Posts: 1,498
Reputation: 122
Default Re: Don't have a site?

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
__________________
Yves is offline   Reply With Quote
Old 18/04/2013, 01:22 AM   #6
cazanova
Little Clucker
 
cazanova's Avatar
 
Join Date: Apr 2012
Location: Homme
Posts: 33
Reputation: 0
Default Re: Don't have a site?

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 !!
cazanova is offline   Reply With Quote
Old 18/04/2013, 02:59 PM   #7
RandomDude
Huge Clucker
 
Join Date: Jun 2011
Location: Behind You
Posts: 390
Reputation: 0
Default Re: Don't have a site?

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
RandomDude is offline   Reply With Quote
Old 18/04/2013, 03:44 PM   #8
thefatshizms
High-roller
 
thefatshizms's Avatar
 
Join Date: Dec 2011
Location: England
Posts: 1,744
Reputation: 259
Default Re: Don't have a site?

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];
__________________
SFCNR ******* | SFCNR Forum
thefatshizms is offline   Reply With Quote
Old 18/04/2013, 03:59 PM   #9
RandomDude
Huge Clucker
 
Join Date: Jun 2011
Location: Behind You
Posts: 390
Reputation: 0
Default Re: Don't have a site?

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.
RandomDude is offline   Reply With Quote
Old 18/04/2013, 04:06 PM   #10
Bicentric
Big Clucker
 
Join Date: Sep 2012
Posts: 143
Reputation: 36
Default Re: Don't have a site?

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.
Bicentric is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Site Palaa Server Support 2 10/07/2012 10:03 AM
[Ajuda] Site Adriano_MQD Português/Portuguese 3 06/07/2012 01:58 AM
how to host your own videos on your site own site for free sherlock Everything and Nothing 3 17/09/2011 05:29 PM
I need help with my site gupey1984 Client Support 4 19/11/2010 03:51 AM


All times are GMT. The time now is 01:12 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.