
Originally Posted by
cooldude159
:shoot x Make sure you dont need enter the Username
Shoot other person
Holo: RP v26
Code:
health_db = DB.runRead("SELECT health FROM users WHERE name = '" + Target._Username + "'");
str_db = DB.runRead("SELECT str FROM users WHERE name = '" + _Username + "'");
//turns str into an int
int str_mod = int.Parse(str_db);
//generates a random number
Random randNum = new Random();
int hit_dif_0 = randNum.Next(1, 1);
int hit_dif_1 = randNum.Next(1, 1);
//what a user hits
int strength = int.Parse(str_db);
int hit_max = (strength * 3) + 25;
int hit_min = (strength + 10);
int hit = randNum.Next(hit_min, hit_max);
DB.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + Target._Username + "'");
DB.runQuery("UPDATE users SET punches = punches+1 WHERE name = '" + _Username + "'");
health_db_ko = DB.runRead("SELECT health FROM users WHERE name = '" + Target._Username + "'");
int health_int = int.Parse(health_db_ko);
if (health_int < 1)
{
if (Target._isPet == true)
{
Target.roomUser.makeHuman();
}
Room.sendShout(roomUser, "*Shoots " + Target._Username + ", killing them.*", true);
Target.roomUser.walkLock = true; // Freeze the user
Target._Mission = "Under Rehabilitation";
Target.refreshAppearance(false, true, true);
DB.runQuery("UPDATE users SET dead = '1' WHERE name = '" + Target._Username + "'");
Target.sendData("D^" + "H" + Encoding.encodeVL64(3));
DB.runQuery("UPDATE users SET working = '0' WHERE name = '" + Target._Username + "'");
DB.runQuery("UPDATE users SET kills = kills+1 WHERE name = '" + _Username + "'");
}
else if (health_int > 1)
{
Room.sendShout(roomUser, "*Shoots " + args[1] + ", causing " + hit + " damage*", true);
}
CD = new Thread(new ThreadStart(this.subcooldown));
CD.Priority = ThreadPriority.BelowNormal;
CD.Start();
//if the user has 0 or less helth left
}
else if (_Cooldown == true)
{
Room.sendWhisper(roomUser, Sorry, "You cannot process this command at the moment");
}
}
}
}
else
{
Room.sendShout(roomUser, "*Shoots at " + args[1] + ", but misses*", false);
}
break;
}
#endregion