Here are php scripts which people might find useful.
1. PVP Rankings - It shows the top 25 players in the server in order of kills
2. UM Res - Allows users to rez dead UM toons
I'll add more scripts as I make them.If you have any feedback post here
UPDATE1 : Char-res improved (new approach)
UPDATE2: Char-res, now easier with more than 1 toon with same name
I only looked at the res script so far and I noticed you can cut out some duplicate code and cut down the queries by one by changing this:
Code:
if($slot[0]>-1 && $slot[0]<5)
{
$res3 = mssql_query("SELECT * FROM [dbo].[UserMaxGrow] WHERE UserUID IN (SELECT UserUID FROM dbo.Chars WHERE UserID='$login')");
$country = mssql_fetch_array($res3);
if ( $country['Country'] == 0 ) {
$res4 = mssql_query("SELECT family FROM [dbo].[Chars] WHERE charname='$toon'");
$family = mssql_fetch_array($res4);
echo "Family = $family[0] <br />";
if ( $family[0] == 0 || $family[0] == 1)
{
mssql_query("UPDATE dbo.Chars SET Del=0, Slot=$slot[0] , Map=42 , PosX=63 , PosZ=57 , DeleteDate=NULL WHERE CharName = '$toon'");
echo "$toon was successfully resurrected</font>";
}
else
echo "Faction Error: Cannot ressurect UoF toon on AoL";
}
else if( $country['Country'] == 1) {
$res4 = mssql_query("SELECT family FROM [dbo].[Chars] WHERE charname='$toon'");
$family = mssql_fetch_array($res4);
if ( $family[0] == 2 || $family[0] == 3)
{
mssql_query("UPDATE dbo.Chars SET Del=0, Slot=$slot[0] , Map=42 , PosX=63 , PosZ=57 , DeleteDate=NULL WHERE CharName = '$toon'");
echo "$toon was successfully resurrected</font>";
}
else
echo "Faction Error: Cannot ressurect AoL toon on UoF";
}
else
echo "Faction error";
}
else
echo "No slot avaliable";
To something like this:
Code:
if($slot[0]>-1 && $slot[0]<5){
$res3 = mssql_query("SELECT umg.Country, c.Family FROM [dbo].[UserMaxGrow] AS umg INNER JOIN [dbo].[Chars] AS c ON umg.UserUID = c.UserUID WHERE c.UserID = '$login' AND c.CharName = '$toon'");
$result = mssql_fetch_array($res3);
if($result['Country'] == 0 || $result['Country'] == 1){
if($result['Family'] >= 0 && $result['Family'] <= 3){
mssql_query("UPDATE dbo.Chars SET Del=0, Slot=$slot[0], Map=42, PosX=63 , PosZ=57, DeleteDate=NULL WHERE CharName = '$toon'");
echo "$toon was successfully resurrected</font>";
}else{
if($result['Family'] == 0 || $result['Family'] == 1){
echo "Faction Error: Cannot ressurect UoF toon on AoL";
}else if($result['Family'] == 2 || $result['Family'] == 3){
echo "Faction Error: Cannot ressurect AoL toon on UoF";
}
}
}else{
echo "Faction error";
}
}else{
echo "No slot available";
}
Generally it is considered bad practice to use SELECT *, because you are returning more data than you are actually using, unless you are using ALL columns. It is better to specifically ask for the columns you want.
I would suggest using joins instead of sub queries when possible as well. Take a look at my $res3 query as an example.
Also I would use dictionary indexes instead of array indexes when asking for data from query results, otherwise you are asking for trouble if the order ever changes.
How come you chose to echo some of the html, but not all of it, or vice versa?
Overall the res script looks good. It also appears to be secure also which is the most important part. I didn't actually test anything though, just browsed through the script.
I haven't read into the original script but your optimization will do the same what I had problem with. Meaning my first UM resurrection script resurrected an AoL character on UoF side. You need to check for Country separately with extra checks for Family. Players can change sides if they loose all of their characters.
Country=2 is only when all characters are dead. It means Faction Selection screen.
EDIT:
Here's my solution to this problem:
Code:
IF (SELECT Country FROM PS_GameData.dbo.UserMaxGrow WHERE UserUID=@UserUID)<>2
begin
PRINT 'Player chose faction after loosing all characters. Checking whether new characters exist.'
-- let's get that new faction and see if it's the same as the last time
SELECT @Country=Country FROM PS_GameData.dbo.UserMaxGrow WHERE UserUID=@UserUID
IF EXISTS (SELECT * FROM PS_GameData.dbo.Chars WHERE UserUID=@UserUID AND Del=0)
begin
PRINT 'Player has new characters. Checking faction.'
PRINT '----------'
IF (@Family=0 OR @Family=1) AND @Country<>0
begin
-- Faction is not the same. Was Alliance of Light is Union of Fury. Character not resurrected.
INSERT INTO @ResultTable
(CharID, CharName, Resurrected, NoFreeSlots, FactionChange)
VALUES
(@CharID, @CharName, 'no', 'no', 'yes');
FETCH NEXT FROM dead_um INTO
@UserUID,@CharID,@Slot,@CharName,@Family
CONTINUE;
end
ELSE IF (@Family=2 OR @Family=3) AND @Country<>1
begin
-- Faction is not the same. Was Union of Fury is Alliance of Light. Character not resurrected.
INSERT INTO @ResultTable
(CharID, CharName, Resurrected, NoFreeSlots, FactionChange)
VALUES
(@CharID, @CharName, 'no', 'no', 'yes');
FETCH NEXT FROM dead_um INTO
@UserUID,@CharID,@Slot,@CharName,@Family
CONTINUE;
end
end
ELSE
begin
PRINT 'No new characters detected. Proceeding with standard routine.'
PRINT '----------'
end
end
I haven't read into the original script but your optimization will do the same what I had problem with. Meaning my first UM resurrection script resurrected an AoL character on UoF side. You need to check for Country separately with extra checks for Family. Players can change sides if they loose all of their characters.
Country=2 is only when all characters are dead. It means Faction Selection screen.
Thanks, I didn't catch that logic when I was optimizing. Zargon pm'ed me about it too.
Since both are running identical code, you could make the error message more generic and do it kind of like this:
Code:
if($slot[0]>-1 && $slot[0]<5){
$res3 = mssql_query("SELECT umg.Country, c.Family FROM [dbo].[UserMaxGrow] AS umg INNER JOIN [dbo].[Chars] AS c ON umg.UserUID = c.UserUID WHERE c.UserID = '$login' AND c.CharName = '$toon'");
$result = mssql_fetch_array($res3);
if(
($result['Country'] != 0 && ($result['Family'] == 0 || $result['Family'] == 1)) ||
($result['Country'] != 1 && ($result['Family'] == 2 || $result['Family'] == 3))
){
echo "Faction Error: Cannot ressurect toon into the opposite faction of which they were born into.";
}else{
mssql_query("UPDATE dbo.Chars SET Del=0, Slot=$slot[0], Map=42, PosX=63 , PosZ=57, DeleteDate=NULL WHERE CharName = '$toon'");
echo "$toon was successfully resurrected</font>";
}
}else{
echo "No slot available";
}
Apparently Zargon is unable to use the dictionary indexes. I know that when I rewrote this script the dictionary indexes worked for me, so I'm unsure why he would have problems with them.
I made a new approch since abrasive's post, now toons that are in opposing faction are not dispalyed/avaliable to ressurection. I also forgot about more than 1 toon with same name so I am going to make a work-around. The dictionary index work when I use SELECT * but when I use JOINS it displays undefined index. I am going to try and fix this.
Did you add it in character searching query? I was about to suggest it to avoid selecting characters which were deleted by user. RemainTime<>0 is delete requested by user.
Btw, the script works. I tested it on my database.
I had to add it the the updating query at the end, it was reviving the characters only partially, although that was before the latest post, so I am not sure if he has added that or not.
You shouldn't add RemainTime=0 in UPDATE statement. You will resurrect characters deleted by player this way. RemainTime=0 should be in WHERE clause in SELECT statement searching for player's dead characters.
[Release]Scripts,Hacks ... 09/19/2010 - Counter-Strike Hacks, Bots, Cheats & Exploits - 5 Replies Heey leutz bin zwar neu hier und ich denke ihr werdet mir nicht vertrauen <.<, aber trotzdem Release ich ein paar Scripts und einen hack den ich kenne.Wer mir nicht vertraut virustotal.com ! Hoffe es kommen faire Comments und nicht irgend ein geflame weil ich neu bin =)
Unter den Überschriften steht das HowTo!
Scipts:
Pingfake=
[PRE-RELEASE] easy translate scripts. 03/20/2010 - EO PServer Hosting - 11 Replies hey, i have asked the question, and have got some reaction.
So here it is. Not every thing is translated but most things you see are. (basic eudemons + basic monsters + basic guards)
If you have some idea's for me that i also need to make a script for, feel free to ask :bandit:
"example of script"
[Release] scripts 03/03/2010 - Dekaron Exploits, Hacks, Bots, Tools & Macros - 2 Replies These are working cheat engine scripts ( i take no credit for creating them) I put the new offsets in them so just copy and paste into autoassembler.
MOB SPEED:
alloc(DrakoMobSpeed,64)
label(MobIsWalking)
label(ReturnMobSpeed)
label(MobRunSpeed)
label(MobWalkSpeed)
[Release] EMS 0.59 scripts 12/29/2009 - MapleStory - 1 Replies Not posting a HS (CRC) Bypass, leech yourself one else where.
All scripts WERE made or updated by me.
No Knockback
007D52FF:
jnl 007d5304
[RELEASE]Scripts for the stack eps. 09/08/2009 - EO PServer Guides & Releases - 34 Replies well there was a release of stack eps lready but i'll be more clver and make it a lot easier for you ,because most of the server have different cq_itemtypes and cq_actions that's why i have decided to release the scripts for it so you dont have to change your cq_action. :):D :cool:
Because there is no way to make any scripts for the itemtype.dat i have made one, this itemtype.dat is the latest one there is, it contains all the new pets form chinese database and everything else, of course it;s...