• Welcome to Vice City Multiplayer.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ricardo

#31
mIRC/pawn Scripting / Pawn data storage?
January 17, 2010, 12:56:07 AM
Hi,

would someone please tell me what/all methods of permanently storing data we have in pawn, i can only see "Dini.inc" (ini files).

thankyou
#32
As you know, using mIRC's !writini command will add the item and its value to the end of the section, causing the values to be unordered.

By using the filter command, we can retain the numerical sequence of the "level" (value) every time a "command" (item) is added, replaced or removed.



/*
** NOTE:
**
** The following alias adds, replaces or removes
** a command and its admin level in cmd.ini,
** keeping the levels in numerical sequence.

** Syntax:
** SetCommandLevel <NewCmd> <NewCmdLvl>

** Examples:
** SetCommandLevel !givecash 5 ; Add or Replace
** SetCommandLevel !givecash DEL  ; Delete
*/

alias SetCommandLevel {

  var %NewCmd = $1, %NewCmdLvl = $2

  var %file = cmd.ini, %section = COMMANDS

  ; Create Hidden Window
  window -h @cmds

  var %a = 1, %b = 2, %c = 1, %t

  ; Total Commands
  %t = $ini(%file,%section,0)

  ; Hold %file in buffer
  while (%a <= %t) { echo @cmds $ini(%file,%section,%a) $readini(%file,%section,$ini(%file,%section,%a)) | inc %a }

  ; Insert, Replace or remove
  ; New-Command to buffer
  if ($2 isnum) {
    $iif( $fline(@cmds,$+(*,%NewCmd,*),1), !rline @cmds $fline(@cmds,$+(*,%NewCmd,*),1) %NewCmd %NewCmdLvl, !aline @cmds %NewCmd %NewCmdLvl )
  }
  elseif ($2 == DEL) { dline @cmds $fline(@cmds,$+(*,%NewCmd,*),1) }

  ; Remove original section/values
  !remini %file %section

  ; Readd Section
  !write -il1 %file $+([,%section,])

  ; Sort by level
  filter -wwcut 2 32 @cmds @cmds

  ; Loop through buffer and write back contents
  while $line(@cmds,%c) { var %cmd = $gettok($v1,1,32), %lvl = $gettok($v1,2,32) | !write -il $+ %b %file $+(%cmd,=,%lvl) | !inc %b | !inc %c }

  ; Close window
  window -c @cmds
}



By having knowledge of string manipulation, we can also pass multiple values to our custom procedure.


alias SetMultipleCmds {
  ; Commands to add (separated by space)
  var %a, %strCmds = !buycar=1 !sellcar=1 !mycars=1

  ; Loop through strCmds and pass to "SetCommandLevel"
  while (%a <= $numtok(%strCmds,32)) { SetCommandLevel $replace($gettok(%strCmds,%a,32),$chr(61),$chr(32)) | inc %a }

  ; Remove multipe commands from cmd.ini
  ; while (%a <= $numtok(%strCmds,32)) { SetCommandLevel $replace($gettok(%strCmds,%a,32),$mid($gettok(%strCmds,%a,32),$pos($gettok(%strCmds,%a,32),=), $len($gettok(%strCmds,%a,32))), $chr(32) DEL) | inc %a }
}

#33
Quote from: ricardo on January 15, 2010, 09:49:31 PM
sorry. can anyone help me with this?

i can add commands, how to remove using this way



alias test {
  ; Commands to add (separated by space)
  var %strCmds = !buycar=1 !sellcar=1 !mycars=1, %a = 1

  ; Loop through strCmds and pass to "SetCommandLevel"
  while (%a <= $numtok(%strCmds,32)) { SetCommandLevel $replace($gettok(%strCmds,%a,32),$chr(61),$chr(32)) | inc %a }
}




I DID IT: HERE IS IT IN ONE

/*
** NOTE:
**
** The following alias adds, replaces or removes
** a command and its admin level in cmd.ini,
** keeping the levels in numerical sequence.

** Syntax:
** SetCommandLevel <NewCmd> <NewCmdLvl>

** Examples:
** SetCommandLevel !givecash 5 ; Add or Replace
** SetCommandLevel !givecash DEL  ; Delete
*/

alias SetCommandLevel {

  var %NewCmd = $1, %NewCmdLvl = $2

  var %file = cmd.ini, %section = COMMANDS

  ; Create Hidden Window
  window -h @cmds

  var %a = 1, %b = 2, %c = 1, %t

  ; Total Commands
  %t = $ini(%file,%section,0)

  ; Hold %file in buffer
  while (%a <= %t) { echo @cmds $ini(%file,%section,%a) $readini(%file,%section,$ini(%file,%section,%a)) | inc %a }

  ; Insert, Replace or remove
  ; New-Command to buffer
  if ($2 isnum) {
    $iif( $fline(@cmds,$+(*,%NewCmd,*),1), !rline @cmds $fline(@cmds,$+(*,%NewCmd,*),1) %NewCmd %NewCmdLvl, !aline @cmds %NewCmd %NewCmdLvl )
  }
  elseif ($2 == DEL) { dline @cmds $fline(@cmds,$+(*,%NewCmd,*),1) }

  ; Remove original section/values
  !remini %file %section

  ; Readd Section
  !write -il1 %file $+([,%section,])

  ; Sort by level
  filter -wwcut 2 32 @cmds @cmds

  ; Loop through buffer and write back contents
  while $line(@cmds,%c) { var %cmd = $gettok($v1,1,32), %lvl = $gettok($v1,2,32) | !write -il $+ %b %file $+(%cmd,=,%lvl) | !inc %b | !inc %c }

  ; Close window
  window -c @cmds
}


alias AddMultipleCmds {
  ; Commands to add (separated by space)
  var %a, %strCmds = !buycar=1 !sellcar=1 !mycars=1

  ; Loop through strCmds and pass to "SetCommandLevel"
  while (%a <= $numtok(%strCmds,32)) { SetCommandLevel $replace($gettok(%strCmds,%a,32),$chr(61),$chr(32)) | inc %a }

  ; Remove multipe commands from cmd.ini
  ; while (%a <= $numtok(%strCmds,32)) { SetCommandLevel $replace($gettok(%strCmds,%a,32),$mid($gettok(%strCmds,%a,32),$pos($gettok(%strCmds,%a,32),=), $len($gettok(%strCmds,%a,32))), $chr(32) DEL) | inc %a }
}

#34
mIRC/pawn Scripting / Re: List of Bugs with Pawno
January 16, 2010, 07:21:03 PM
lol i think the lesson here is.. STAY AWAY FROM THE PAWN SERVER UNTIL ALL THIS IS FIXED.

Trix rox @ pawn scripting - MonkeyScripts++
#35
sorry. can anyone help me with this?

i can add commands, how to remove using this way



alias test {
  ; Commands to add (separated by space)
  var %strCmds = !buycar=1 !sellcar=1 !mycars=1, %a = 1

  ; Loop through strCmds and pass to "SetCommandLevel"
  while (%a <= $numtok(%strCmds,32)) { SetCommandLevel $replace($gettok(%strCmds,%a,32),$chr(61),$chr(32)) | inc %a }
}

#36
GUS / FBS AND PSYSCRIPT PEOPLE CAN USE THIS



/*
** NOTE:
**
** The following alias adds, replaces or removes
** a command and its admin level in cmd.ini,
** keeping the levels in numerical sequence.

** Syntax:
** SetCommandLevel <NewCmd> <NewCmdLvl>

** Examples:
** SetCommandLevel !givecash 5 ; Add or Replace
** SetCommandLevel !givecash DEL  ; Delete
*/

alias SetCommandLevel {

 var %NewCmd = $1, %NewCmdLvl = $2

 var %file = cmd.ini, %section = COMMANDS

 ; Creat Hidden Window
 window -h @cmds

 var %a = 1, %b = 2, %c = 1, %t

 ; Total Commands
 %t = $ini(%file,%section,0)

 ; Hold %file in buffer
 while (%a <= %t) { echo @cmds $ini(%file,%section,%a) $readini(%file,%section,$ini(%file,%section,%a)) | inc %a }

 ; Insert, Replace or remove
 ; New-Command to buffer
 if ($2 isnum) {
   $iif( $fline(@cmds,$+(*,%NewCmd,*),1), !rline @cmds $fline(@cmds,$+(*,%NewCmd,*),1) %NewCmd %NewCmdLvl, !aline @cmds %NewCmd %NewCmdLvl )
 }
 elseif ($2 == DEL) { dline @cmds $fline(@cmds,$+(*,%NewCmd,*),1) }

 ; Remove original section/values
 !remini %file %section

 ; Readd Section
 !write -il1 %file $+([,%section,])

 ; Sort by level
 filter -wwcut 2 32 @cmds @cmds

 ; Loop through buffer and write back contents
 while $line(@cmds,%c) { var %cmd = $gettok($v1,1,32), %lvl = $gettok($v1,2,32) | !write -il $+ %b %file $+(%cmd,=,%lvl) | !inc %b | !inc %c }

 ; Close window
 window -c @cmds
}
#37
ShowRoom (pawn) / Re: Monkey Scripts 0.1
January 14, 2010, 11:26:28 PM
THANKS TRIX, YOUR GOOD A PAWNO.

I'LL USE YOUR SCRIPT NOW.
#38
Public Beta / Re: [Crash]0x00535256
January 14, 2010, 11:17:42 PM
died and spawned again, crashed with this error halfway through spawning


Exception At Address: 0x00403ED2

Registers:
EAX: 0x3F800000 EBX: 0x0432AE00 ECX: 0x00000000 EDX: 0x06780A00
ESI: 0x0012FD6C EDI: 0x0012FD70 EBP: 0x0429BDF8 ESP: 0x0012FC54
EFLAGS: 0x00210246

Stack:
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x3F800000
0x44904C42
0x3F800000
0x014D00DE
0x022B01BC
0x0309029A
0x03E80378
0x03E801F4
0x00320032
0x00320032
0x00320032
0x00320032
0x00320032
0x00000000
0x00000000
0x00000000
#39
mIRC/pawn Scripting / Re: rcon irc dll documentation?
December 27, 2009, 12:53:11 PM
QUOTE FROM HERE:

http://forum.vicecitymultiplayer.com/index.php?topic=386.0

"Decided to recreate the VC-MP mIRC dll due to the hacky method that had to be used to retrieve data from the server and keep it connected.

The dll handles all the network connections, incoming data etc and parse the data. so no more if ($1 == [join]) "


WHY WE STILL USING THIS "HACKY" METHOD IN THE NEW VC:MP RELEASE ?
#40
Script Showroom / Re: New VC-MP mIRC Admin
December 27, 2009, 10:38:37 AM
my script PsySQLite 1 any news on a complete dll ?