• Welcome to Vice City Multiplayer.
 

Scripting Help :]

Started by Chezor, March 15, 2008, 05:54:32 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Chezor

Quote from: matthiasvegh on July 26, 2007, 06:04:06 PM

lets start with a basic script every tutorial starts with.
You want the server to say "Hello World!"
but you want it to be a bit more complex, you want the server to say this, when a player says !hello
we now need to decide, wether we want "Hello world" to be public, or just the player who said this can see it.

place this code into your script some where near line 1194 (it doesnt really matter, but near the !info command is a good place to put it)
elseif ($2 == !hello) || ($2 == !pmhello) {
vcmp.msg $2 %id Hello World!
}


ok. that was our first code. now, the part vcmp.msg is the actual "what to do" thing in the script. $2 %id specifies who to send the message to. Hello world, is the parameter on the actual action. therefore, irc has to send a message, defined in parameters.
if we want the "Hello world!" to be public, replace vcmp.msg with vcmp.say

If we want to check weather player has the right to see "hello world", place an IF before the vcmp.msg:
elseif ($2 == !hello) || ($2 == !pmhello) {
if ($vcmp.cmdcheck(!hello,%id) == fail) !halt
else vcmp.msg $2 %id Hello World!
}

now, the if line, does the following
checks if the value after !hello in vcmp.cmdlevel.ini is larger than the players admin level. if it is larger it goes to !halt. if smaller, it ignores !halt and does the next line, which is hello world
!halt, is a storno, but im not sure, if it gives an error message or not.

btw, due to the error (not sure if its an error)
i would like to clear the alias's

well im new to vcmp scripting so i was just searching for tutorials also googling for tutorils. but i found none tutorials. also i found that if i want to learn scripting i have to read the script made by others and understand it. so i have learned something.

well i found that topic of tutorial from matthiasvegh :
So i can also say that the hello command is wrong its actually :

elseif ($2 == !hello) || ($2 == !pmhello) {
vcmp.msg %id Hello World!
}


I have modified many things in GUS and now i know how to change the script.
I added various commands like

weather commands : !rain, !clear, !fog, !eclipse, !storm, etc

and the settime command in gus was not working for me ( i also modified it and now it works)
: !settime, !morning, !noon, !evening, !midnite




now i need to know is : how to make !time command so that it shows current time shown in top right corner of the game !

Also i want to know how to make a command like !gotohideout <locname> so only admin lvl 1 can go to that location. and no other player can go to that location.
same as !gotoloc command but i want gotoloc for all ppl and gotohideout commands only for admins. help me with it.

Also i need help with buying cars. if u guys dont wana give script for buying cars at least give me the idea how to make it or explain me.

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..

ReVilo

gethr (outputs current hr to [gethr] <currenthour>)
getmin (outputs current minute to [getmin] <currentminute>)

make aliases for those rcon commands, and you'll be on your way :P

Mex

Quote from: Chezor on March 15, 2008, 05:54:32 PM
at least give me the idea how to make it or explain me.

Each vehicle has a unique id.  This might help:
http://forum.vicecitymultiplayer.com/index.php?topic=135.0

Quote from: Chezor on March 15, 2008, 05:54:32 PM
Also i want to know how to make a command like !gotohideout <locname> so only admin lvl 1 can go to that location. and no other player can go to that location.

Heres a really basic bit of code which should help you.

if ($2 == !gotohideout) {
  if ($adminlevel(%name) < 1) { vcmp.msg %id You mustbe admin level 1. }
  elseif ($3 == bank) { vcmp.setlocation %id <x> <y> <z> [<interior>] }
  elseif ($3 == ssa) { vcmp.setlocation %id <x> <y> <z> [<interior>] }
  elseif ($3 == roof) { vcmp.setlocation %id <x> <y> <z> [<interior>] }
  else { vcmp.msg %id Invalid location name. }
}
elseif ($2 == !setlevel) {
  if ($4 == $null) { vcmp.msg %id !setlevel <fullnick> <level> }
  else { !writeini -n $qt($scriptdir $+ adminlevel.ini) Levels $3 $4 }
}
alias adminlevel { !return $iif($readini($qt($scriptdir $+ adminlevel.ini),Levels,$1),$v1,0)