How To Script

Started by Dhrubo, May 30, 2016, 06:22 AM

Previous topic - Next topic

Dhrubo

Hello I wanna script a server so, I need details. How can I script a server?
Don't be afraid of anything if you try you can do anything.

Murdock

You should consider some programming courses first, I wouldn't recommend starting with a non-typesafe language

.

Quote from: Murdock on May 30, 2016, 08:15 AMYou should consider some programming courses first, I wouldn't recommend starting with a non-typesafe language

F* your basics man. I wanna code 8)
.

vito

#3
download - http://forum.vc-mp.org/?topic=33.0

then edit main.nut file using something from:
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Functions
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Events
Quote from: Murdock on May 30, 2016, 08:15 AMYou should consider some programming courses first, I wouldn't recommend starting with a non-typesafe language
Yes. If you new in coding - better to start from javascript. It's very tolerant for newbies.

Dhrubo

Thanks for that, but I don't know how to add it copy paste? I tried that but didn't worked.
Don't be afraid of anything if you try you can do anything.

Stormeus

Quote from: Dhrubo on May 30, 2016, 09:25 AMI don't know how to add it copy paste?

Literally nothing good has been developed by blindly copying and pasting from other people. Learn how to actually script on your own first.

Dhrubo

But how could I learn how to script a server. A time WiLsOn told me that delete system 32. So, I asked what to do then but he didn't wanted to answer me.
Don't be afraid of anything if you try you can do anything.

KAKAN

But why is the topic located in "Tutorials" section?
oh no

Dhrubo

I don't know but I think it's tutorial that I wanna know.
Don't be afraid of anything if you try you can do anything.

.

#9
To be honest, I encounter this question on a weekly basis. And my answer (and advice) is always the same: Anyone asking questions like "how do I code?" will never end up a programmer. And will never end up writing more than 2 lines of code that aren't either copied from someone else or broken as hell. You don't see a lion be like "how do I hunt?" or a bird "how do I fly?". They just know. Programmers have the curiosity, persistence and ambition to learn all by themselves.

Programming involves a lot of self documentation. About 50% of the time you document yourself. And if you can't figure out on your own how to start programming then how will you be able to search when you need to know or learn something. At what point it started to be alright to start programming when you can't even search something?

Programming is not something you learn overnight or over the course of a week. It's not like learning to ride a bicycle. It takes years of constant learning and practice. So just try to understand your current position before you decide you want to achieve something.

I'm not trying to discourage you. I'm just trying to make sure you know what to expect and not get your hopes up only to be disappointed later when you realize the truth.
.

aXXo


Dhrubo

/ban worked bye copy pasting but /unbanip not worked.
Don't be afraid of anything if you try you can do anything.

KAKAN

$h0W C0DE( show your code )
oh no

Dhrubo

Thanks for all replies now I have learned that how to script :) so no need to help me I am scripting now. Hmm KAKAN wait showing my code:
function onPlayerCommand( player, cmd, text )
{
   if (cmd == "unbanip")
   {
      if(!IsIPBanned(text) == true)
      {
         ClientMessage("Provided IP '" + text + "' was not banned previously",player,255,255,255);
      }
      else
      {
         UnbanIP(text);
         ClientMessage("Unbanned IP: " + text,player,255,255,255);
      }
   }
}
Don't be afraid of anything if you try you can do anything.

EK.IceFlake

No null checking on text, risk of crash.
No administrative check, risk of abuse.
Try to fix these two
And post your UnbanIP because that is the core of your unban command.