Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/17/25 in all areas

  1. I did this basic script, maybe it will help you. CREATE TABLE IF NOT EXISTS `pvp_rank` ( `char_id` int(11) unsigned NOT NULL, `kills` int(11) unsigned NOT NULL DEFAULT 0, `deaths` int(11) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`char_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; And here's the script. prontera,196,142,5 script PVP Warper 100,{ mes "[ ^FF0000PVP Warper^000000 ]"; mes "Welcome, ^0000FF"+strcharinfo(0)+"^000000."; mes "Please select a PVP room:"; next; // Dynamic menu with player counts .@menu$ = ""; for (.@i = 0; .@i < getarraysize(.pvp_map$); .@i++) { .@users = getmapusers(.pvp_map$[.@i]); .@menu$ += .pvp_name$[.@i]+" ["+.@users+"/"+.pvp_max[.@i]+"]:"; } .@sel = select(.@menu$) - 1; if (BaseLevel < .pvp_level[.@sel]) { mes "[ ^FF0000PVP Warper^000000 ]"; mes "You must be at least level "+.pvp_level[.@sel]+" to enter this room."; close; } if (getmapusers(.pvp_map$[.@sel]) >= .pvp_max[.@sel]) { mes "[ ^FF0000PVP Warper^000000 ]"; mes "This room has reached its player limit ("+.pvp_max[.@sel]+")."; close; } warp .pvp_map$[.@sel],0,0; end; OnPCKillEvent: // Validate if map is a valid PVP room .@valid = 0; for (.@i = 0; .@i < getarraysize(.pvp_map$); .@i++) { if (strcharinfo(3) == .pvp_map$[.@i]) { .@valid = 1; break; } } if (!.@valid) end; // Get Killer and Victim Char IDs safely .@killer_cid = getcharid(0); .@victim_cid = getcharid(0, rid2name(killedrid)); if (!.@killer_cid || !.@victim_cid || .@killer_cid == .@victim_cid) end; // Always register kills and deaths for all maps query_sql("INSERT INTO pvp_rank (`char_id`, `kills`, `deaths`) VALUES ("+.@killer_cid+",1,0),("+.@victim_cid+",0,1) ON DUPLICATE KEY UPDATE `kills`=`kills`+VALUES(`kills`), `deaths`=`deaths`+VALUES(`deaths`)"); // Only grant special points in the GM-selected map if (strcharinfo(3) != .points_map$) end; // IP check validation (enabled or disabled by admin) if (.ip_check_enabled) { query_sql("SELECT last_ip FROM login WHERE account_id="+getcharid(3), .@killer_ip$); query_sql("SELECT last_ip FROM login WHERE account_id="+killedrid, .@victim_ip$); if (.@killer_ip$ == .@victim_ip$) { dispbottom "[PVP Warper]: No points granted. Same IP detected."; end; } } // Kill cooldown validation .@current_time = gettimetick(2); .@cooldown = .kill_cooldown; .@kill_cd_var$ = "kill_cd_"+.@killer_cid+"_"+.@victim_cid; if (getd(.@kill_cd_var$) + .@cooldown > .@current_time) { dispbottom "[PVP Warper]: You recently killed this player. Wait before earning more points."; end; } setd .@kill_cd_var$, .@current_time; // Add your special points reward code here. // Example: set pvp_points, pvp_points + 1; dispbottom "[PVP Warper]: You've earned special points for defeating a player."; end; OnCheckRank: mes "[ ^FF0000PVP Warper^000000 ]"; query_sql("SELECT kills, deaths FROM pvp_rank WHERE char_id="+ getcharid(0), .@kills, .@deaths); mes "Tus estadísticas actuales:"; mes "^0000FFKills:^000000 "+ (.@kills ? .@kills : 0); mes "^FF0000Muertes:^000000 "+ (.@deaths ? .@deaths : 0); close; OnGMResetRank: if (getgmlevel() < 60) { dispbottom "No tienes permisos para usar este comando."; end; } query_sql("TRUNCATE TABLE pvp_rank"); dispbottom "Ranking PVP reiniciado correctamente."; end; OnInit: // General Configuration setarray .pvp_map$[0], "guild_vs1", "guild_vs2", "pvp_y_1-2"; setarray .pvp_name$[0], "PVP Room 1", "PVP Room 2", "PVP Prontera"; setarray .pvp_level[0], 1, 50, 99; setarray .pvp_max[0], 10, 15, 20; // Enable or disable IP check (1 = ON, 0 = OFF) .ip_check_enabled = 0; // Kill cooldown in seconds (recommended: 60-120 sec) .kill_cooldown = 60; // GM configuration: Set the map that gives special points here (default is room 1) .points_map$ = .pvp_map$[0]; // Change [0] to [1] or [2] to switch rooms // Commands for player and GM bindatcmd "pvprank",strnpcinfo(3)+"::OnCheckRank"; bindatcmd "resetpvprank",strnpcinfo(3)+"::OnGMResetRank",60,60; end; } Feel free to ask for a change.
    1 point
  2. View File AnyMapDrops This mod made in map_drops.yml now allows you to add drops globally (without specifying a map), I also added a parameter where the added item can go directly to the player's inventory if there is space. Example of use ( db\import\map_drops.yml ) Header: Type: MAP_DROP_DB Version: 2 Body: - Map: ANY GlobalDrops: - Index: 0 Item: Union_Token Rate: 50000 DirectInventory: true - Index: 1 Item: Flower Rate: 100000 SpecificDrops: - Monster: Fabre Drops: - Index: 0 Item: White_Gold_Coin Rate: 50000 DirectInventory: true - Index: 1 Item: Izidor Rate: 50000 - Monster: Poring Drops: - Index: 0 Item: Crystal_Jewel__ Rate: 50000 Note 1: To be valid across all maps, set the map name to ANY. Note 2: The new parameter DirectInventory ( false | true ) allows the item to go directly to the inventory. Note 3: I created 2 new mapflags (nomapdrops and mapdrops), the first is self-explanatory (does not drop any items from map_drops ), the second will be effective for instances, as now map_drops does not drop items in instances, so just apply the second mapflag on the instance (in the instance maps) to make it work again. Example of use: OnInstanceInit: setmapflag instance_mapname("1@nyd"),mf_mapdrops; setmapflag instance_mapname("2@nyd"),mf_mapdrops; Next updates I will add a parameter to mapdrops.yml if you want the item to be dropped in instances too instead of having to use the mapdrops mapflag. Submitter Hyroshima Submitted 06/26/24 Category Source Modifications Video Content Author Hyroshima  
    1 point
×
×
  • Create New...