Vsro Files - Max Cap, NPC Edit, Items

10/02/2011 17:24 PortalDark#16
Quote:
Originally Posted by octaviansan View Post
Sorry, im noob.
How do i do that, could u give me the sql command?
[Only registered and activated users can see links. Click Here To Register...]
trigger is a stored procedure that takes action eveytime something happens on a table(s).
ou must specify what you want to happend after/before somethign is done on database
can be delete/update/insert/select
if i recall, i think MSSQL 2055/2008 has a wizard for easy setup triggers
10/02/2011 17:32 octaviansan#17
So can u look up in the database and make a full tutorial.
I told u, i dont know MSSQL, neither MYSQL.
10/02/2011 17:35 PortalDark#18
Quote:
Originally Posted by octaviansan View Post
So can u look up in the database and make a full tutorial.
I told u, i dont know MSSQL, neither MYSQL.
when i get my home, imma isntal MSSQL and take a look to db. Maybe there is already a procedure to that, but i need to check
10/02/2011 17:36 octaviansan#19
Ok, thank you.

Ok, i managed to make the automatic silks script.
Thank to Yoshi, of course.
10/02/2011 19:58 grasvys112#20
octaviansan can you post your code how you maked silk script
10/02/2011 20:01 octaviansan#21
Make .php file,
Run this in your webserver:
Code:
<?php


for ($i=1423;$i<5000;$i++){
echo "insert into dbo.SK_Silk (JID,silk_own,silk_gift,silk_point) VALUES (".$i.",40000,0,0);<br>";
}

?>
Then take all the sql queries, paste them into the DB, Execute them.
You're done, every account will have 40k silks.
10/02/2011 20:07 PortalDark#22
Quote:
Originally Posted by octaviansan View Post
Make .php file,
Run this in your webserver:
Code:
<?php


for ($i=1423;$i<5000;$i++){
echo "insert into dbo.SK_Silk (JID,silk_own,silk_gift,silk_point) VALUES (".$i.",40000,0,0);<br>";
}

?>
Then take all the sql queries, paste them into the DB, Execute them.
You're done, every account will have 40k silks.
ok that seems useful
in fact i can use part of it to make the trigger
that way silks get assigned auto
10/02/2011 20:14 octaviansan#23
Ok, do that.
Then post here if u want :).
10/02/2011 21:07 Vinator#24
Just add it as a stored procedure and execute it with the "UserJID" as parameter in the _AddNewChar procedure.
10/02/2011 21:20 PortalDark#25
Quote:
Originally Posted by Vinator View Post
Just add it as a stored procedure and execute it with the "UserJID" as parameter in the _AddNewChar procedure.
im gonna make it this way
do it if you want:

Make a trigger that executes when an insert is done
use the UserJID as a reference and do the insert
the only thing to know right now, is if i can insert a duplicated USERJID on silk table
10/02/2011 21:30 LastThief#26
guys if you WANT to add silks automatically after user reg do the following

Quote:
<?php
/* Simple registration page for silkroad server, by Chernobyl
* Settings are at _inc/config.php
* If you get an mssql connection error, while defining totally correct data
* Just use older ntwdblib.dll for your webserver
*/
require_once('_inc/security.class.php');
require_once('_inc/config.php');

if(!isset($_POST['submit']))
{
echo "<table border='1'>
<form method='post'>
<td>Username</td><td><input type='text' name='username' maxlength='16'></td><tr/>
<td>Password[1]</td><td><input type='password' name='pw1' maxlength='32'></td><tr/>
<td>Password[2]</td><td><input type='password' name='pw2' maxlength='32'></td><tr/>
<td></td><td><input type='submit' name='submit' value='Register'></td>
</form>
</table>";
}
else
{
if(strlen($_POST['username']) < 3) $msg[] = "Username too short";
if(strlen($_POST['username']) > 16)$msg[] = "Username too long";
if(strlen($_POST['pw1']) < 6) $msg[] = "Password [1] too short";
if(strlen($_POST['pw1']) > 32)$msg[] = "Password [1] too long";
if(strlen($_POST['pw2']) < 6) $msg[] = "Password [2] too short";
if(strlen($_POST['pw']) > 32) $msg[] = "Password [2] too long";
if($_POST['pw1'] != $_POST['pw2']) $msg[] = "Passwords are not the same";

$sec = new security();

if($sec->is_secure($_POST['username']) == false) $msg[] = "Username contains forbidden symbols";
if($sec->is_secure($_POST['pw1']) == false) $msg[] = "Password [1] contains forbidden symbols";
if($sec->is_secure($_POST['pw2']) == false) $msg[] = "Password [2] contains forbidden symbols";

if(count($msg) > 0)
{
for($i = 0; $i < count($msg); $i++)
{
echo $msg[$i]."<br/>";
}
return;
}
else
{
//checking damn mssql stuff
$accountExists = mssql_num_rows(mssql_query("select StrUserID from TB_User where StrUserID='$_POST[username]'"));
if($accountExists > 0) echo "Account with such username already exists<br/>";
else
{
$pwd = md5($_POST['pw1']);
mssql_query("insert into TB_User(StrUserID,password,sec_primary,sec_seconda ry) values('$_POST[username]','$pwd','3','3')");
echo "Account successfully created<br/>";

$sql = mssql_query("SELECT * FROM TB_User WHERE StrUserId='$_POST[username]'");
$row = mssql_fetch_array($sql);
$silk = mssql_query("INSERT INTO SK_Silk(JID,silk_own,silk_gift,silk_point) VALUES ('$row[JID]','SILK VALUE HERE','0','0');

}
}


}
What if you want to make it with another page you've to change the bold part with your own var.

example

Quote:
<?php
//reg codes here and also the silk give
?>

<form action="your action page.php" method="POST">
<input type="text" name="user">
it's all about second part the name of your text box replace it with the old 1

$_POST[username] => $_POST[user]

I hope you guys got it :)
10/02/2011 21:39 Vinator#27
Quote:
Originally Posted by PortalDark View Post
im gonna make it this way
do it if you want:

Make a trigger that executes when an insert is done
use the UserJID as a reference and do the insert
the only thing to know right now, is if i can insert a duplicated USERJID on silk table
You could check first if the table already contains the JID if yes then just add more silk or do nothing. If not then insert the row.
10/02/2011 21:48 LastThief#28
Quote:
Originally Posted by Vinator View Post
You could check first if the table already contains the JID if yes then just add more silk or do nothing. If not then insert the row.
how could the user have already silks when account is just created ... ?

best solution to insert silks after executing account via php as my script
10/02/2011 21:49 Vinator#29
Quote:
Originally Posted by LastThief View Post
how could the user have already silks when account is just created ... ?

best solution to insert silks after executing account via php as my script
Read the thread first ... if it's the AddNewChar procedure there already can be silks, because the silks are account bound.
10/02/2011 21:53 LastThief#30
Quote:
Originally Posted by Vinator View Post
Read the thread first ... if it's the AddNewChar procedure there already can be silks, because the silks are account bound.
yes i know but using this sample of code that i gave will fix the problems of silks