New to scripting (/say, /shout etc.)
#1

I would like to know how to insert a command such as /say into a script. Please tell me everything step by step, as do I just copy paste a command into the script or does it have to be in a certain place? Should I use filterscripts for these commands? Do I have to insert something at the beginning of the script? Am I skipping many steps before trying something like /say, and should try some more basic scripting out?
Few commands I found:

Code:
CMD:say(playerid,params[]) 
{ 
  if(PlayerInfo[playerid][pAdmin] >=3)) return SendClientMessage(playerid, 0xFF0000FF, "You can't use this command."); 
  if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: /say (text)"); 
  new lstr[128]; 
  format(lstr,sizeof(lstr),"Admin:%s", params) 
  OOCNews(0x3399FFAA,lstr); 
  return 1; 
}
Code:
CMDay(playerid,params[0])
{
if (isnull(params)) {
SendClientMessage(playerid, COLOR_LIGHTBLUE1, "Usage: /say [text]");
return 1;
}
else {
new string[128];
format(string, sizeof(string), "[SERVER]: %i", params[0]);
SendClientMessageToAll(0xFF9900AA, string);
return 1;
}
}
Reply
#2

First read this https://sampwiki.blast.hk/wiki/Scripting_Basics
then rethink about your question
Reply
#3

There are few things you have to know, the way you learn is basically you imagine something you want to create, then slowly step by step you look into how something is implemented, the you want something else, then you look into it etc..


Start off with like static commands (for example /help) that dont require any user-inputs, then slowly look over all SA:MP natives (SetPlayerHealth, GivePlayerWeapon etc. etc. etc.)
Reply
#4

Quote:
Originally Posted by ProDeplex
View Post
Am I skipping many steps before trying something like /say, and should try some more basic scripting out?
Yes.

I'm not going to reply to your earlier questions because of this ─ you simply wouldn't understand it enough to be able to use the information provided.

Either way, people aren't going to spoon feed you code or a how-to on how to plug something in to your server. Start by experimenting first, I've said it before and I'll say it again, trying to edit code as a beginner is a bad way to learn.


Do things yourself, ****** things, ****** errors you get and read error threads. Compare their issues with yours and look what they did to fix them. If you experiment for a couple of weeks, commands like this will come like nothing. They're super basic but do require a basic understanding of Pawn.


If you have any questions you can add me on Skype (which you can find on my profile under contact info).

Good luck.
Reply
#5

I might have forgot to mention that I'm trying to edit a RP/Freeroam script, not make a entirely new one. If you know how to script, add me on skype: prodeplex , so yo u can support me more effectively. I looked into scripting myself and became more familiar with terms and some code structures, but without guidance I don't think I will be successful.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)