Jump to content

Profile

Members
  • Posts

    77
  • Joined

  • Last visited

Posts posted by Profile

  1. Isnt it possible to add something to the code, so that if the rows are empty it will create them?

    Wouldn't that work?

    UPDATE: I changed the code the to following and is now working fine!

    case "vote":
    // update votepoints
    $sql = "UPDATE $server->loginDatabase.cp_v4p_voters SET votepoints = votepoints + ? WHERE account_id = ?";
    $sth = $server->connection->getStatement($sql);
    $sth->execute(array((int) $res->votepoints, $accoun
    	if ( ! $sth->rowCount())
    {
    	$sql = "INSERT INTO $server->loginDatabase.cp_v4p_voters VALUES (?, ?)";
    	$sth = $server->connection->getStatement($sql);
    	$bind = array($account_id, $res->votepoints);
    	$sth->execute(
    	if ( ! $sth->rowCount())
    		$errorMessage = sprintf(Flux::message("UnableToVote"), 3);

    Also, created a new table called cp_v4p_voters

  2. Hi all, I have installed the Flux addon by Feetly (Vote for points) and everything is working fine... Until I vote.

    https://github.com/Feefty/FluxCP_Addons-VoteForPoints

    The votes are not being updated on the SQL tables when I try to vote, it gives me this error:

    "Unable to vote for the server. Err no. 3"

    Went to index.php on modules and tried to figure out the error, but could't.
    All my SQL tables are there, it's just the "votepoints" that are not being updated when voting.

    This is the code on index.php (Which I think handles the SQL part for adding points).

    <?php if (!defined('FLUX_ROOT')) exit;
    
    $this->loginRequired();
    
    require_once("function.php");
    $vfp_sites		= Flux::config('FluxTables.vfp_sites');
    $vfp_logs		= Flux::config('FluxTables.vfp_logs');
    $cp_tbl			= Flux::config('FluxTables.cashpoints');
    $errorMessage	= NULL;
    
    if (isset($_POST['id']))
    {
    	$id 		= (int) $params->get('id');
    	$ip 		= $_SERVER['REMOTE_ADDR'];
    	$account_id = (int) $session->account->account_id;
    
    	$sql = "SELECT * FROM $server->loginDatabase.$vfp_sites WHERE id = ?";
    	$sth = $server->connection->getStatement($sql);
    	$sth->execute(array($id));
    	$res = $sth->fetch();
    
    	// voting site doesn't exists
    	if ( ! $sth->rowCount())
    	{
    		$errorMessage = Flux::message("VoteDontExists");
    	} else
    
    	// voter is using invalid ip
    	if (Flux::config('EnableIPVoteCheck') && !empty($_SERVER["HTTP_X_FORWARDED_FOR"]) || 
    		Flux::config('EnableIPVoteCheck') && !empty($_SERVER['HTTP_CLIENT_IP']) || 
    		Flux::config('EnableIPVoteCheck') && !empty($_SERVER['HTTP_X_FORWARDED']))
    	{
    		$errorMessage = sprintf(Flux::message("UnableToVote"), 1);
    	} else {
    		// validate for ip address
    		if (Flux::config('EnableIPVoteCheck'))
    		{
    			$sql = "SELECT timestamp_expire FROM $server->loginDatabase.$vfp_logs WHERE ipaddress = ? AND sites_id = ? AND UNIX_TIMESTAMP(timestamp_expire) > ? LIMIT 1";
    			$sth = $server->connection->getStatement($sql);
    			$bind = array($ip, $id, time());
    			$sth->execute($bind);
    
    			if ($sth->rowCount())
    				$errorMessage = Flux::message("AlreadyVoted");
    		}
    
    		// validate for account_id
    		if (is_null($errorMessage))
    		{
    			$sql = "SELECT timestamp_expire FROM $server->loginDatabase.$vfp_logs WHERE account_id = ? AND sites_id = ? AND UNIX_TIMESTAMP(timestamp_expire) > ? LIMIT 1";
    			$sth = $server->connection->getStatement($sql);
    			$bind = array($account_id, $id, time());
    			$sth->execute($bind);
    
    			if ($sth->rowCount()) 
    			{
    				$errorMessage = Flux::message("AlreadyVoted");
    			} else {
    				// update the existing row
    				$sql = "UPDATE $server->loginDatabase.$vfp_logs SET timestamp_expire = ?, timestamp_voted = ?, ipaddress = ? WHERE account_id = ? AND sites_id = ?";
    				$sth = $server->connection->getStatement($sql);
    				$bind = array(
    					date(Flux::config("DateTimeFormat"), strtotime("+".$res->voteinterval." hours")),
    					date(Flux::config("DateTimeFormat")),
    					$ip,
    					$account_id,
    					$id
    				);
    				$sth->execute($bind);
    
    				if ( ! $sth->rowCount())
    				{
    					// insert new row
    					$sql = "INSERT INTO $server->loginDatabase.$vfp_logs VALUES (NULL, ?, ?, ?, ?, ?)";
    					$sth = $server->connection->getStatement($sql);
    					$bind = array(
    						$id,
    						date(Flux::config("DateTimeFormat"), strtotime("+".$res->voteinterval." hours")),
    						date(Flux::config("DateTimeFormat")),
    						$ip,
    						$account_id
    					);
    					$sth->execute($bind);
    
    					if ( ! $sth->rowCount())
    					{
    						$errorMessage = sprintf(Flux::message("UnableToVote"), 2);
    					} else {
    
    						switch (Flux::config('PointsType'))
    						{
    							case "vote":
    								// update votepoints
    								$sql = "UPDATE $server->loginDatabase.cp_createlog SET votepoints = votepoints + ? WHERE account_id = ?";
    								$sth = $server->connection->getStatement($sql);
    								$sth->execute(array((int) $res->votepoints, $account_id));
    
    								if ( ! $sth->rowCount())
    									$errorMessage = sprintf(Flux::message("UnableToVote"), 3);
    							break;
    
    							case "cash":
    								// insert or update cashpoints
    								$cashpoints_var = "#CASHPOINTS";
    								$sql = "UPDATE $cp_tbl SET value = value + ? WHERE key = ? AND account_id = ?";
    								$sth = $server->connection->getStatement($sql);
    								$sth->execute(array((int) $res->votepoints, $cashpoints_var, $account_id));
    
    								// account doesn't have a record for cashpoints
    								// so we will add a row
    								if ( ! $sth->rowCount())
    								{
    									$sql = "INSERT INTO $cp_tbl (`account_id`, `key`, `index`, `value`) VALUES (?, ?, 0, ?)";
    									$sth = $server->connection->getStatement($sql);
    									$bind = array($account_id, $cashpoints_var, $res->votepoints);
    									$sth->execute($bind);
    
    									if ( ! $sth->rowCount())
    										$errorMessage = sprintf(Flux::message("UnableToVote"), 4);
    								}
    							break;
    
    							default:
    								// update credits row
    								$sql = "UPDATE $server->loginDatabase.cp_credits SET balance = balance + ? WHERE account_id = ?";
    								$sth = $server->connection->getStatement($sql);
    								$sth->execute(array((int) $res->votepoints, $account_id));
    
    								if ( ! $sth->rowCount())
    								{
    									// insert new credits row
    									$sql = "INSERT INTO $server->loginDatabase.cp_credits VALUES (?, ?, NULL, NULL)";
    									$sth = $server->connection->getStatement($sql);
    									$sth->execute(array($account, $res->votepoints));
    
    									if ( ! $sth->rowCount())
    										$errorMessage = sprintf(Flux::message("UnableToVote"), 6);
    								}
    							break;
    						}
    					}
    				}
    			}
    		}
    	}
    }
    
    // fetch all voting sites
    $sql = "SELECT * FROM $server->loginDatabase.$vfp_sites";
    $sth = $server->connection->getStatement($sql);
    $sth->execute();
    $votesites_res = $sth->fetchAll();
    
    ?>

    Could anyone give me some assistance?

    THANK YOU!

     

  3. Hello everyone, I have been very busy lately trying to figure out how to install and configure FluxCP. I haven't found any guides around and this just made it much harder.

    Although it took me days of effort, I managed to install the FluxCP Theme from here: 

    Now I'm breaking my head trying to install and configure the "Vote for points" addon. I just can't figure it out! :(

    So what I request here, is maybe a guide from someone who knows/understands how to do this for FluxCP themes so that myself and other members can do it.

    This is the Addon by JayPee, which I have been trying to get to work on my themed fluxCP:

    Thank you!

  4. 15 minutes ago, Capuche said:

    Untested

    
    // instance_db.txt
    // 100,Bossnia,1800,1800,guild_vs2,0,0
    
    
    prontera,154,187,5	script	test5	100,{
    	.@party_id = getcharid(1);
    	.@p_name$ = getpartyname(.@party_id);
    	.@md_name$ = "Bossnia";
    
    	if (!instance_check_party(.@party_id)) {
    		mes "Why don't you make a party with more than 1 person and talk to me again?";
    		close;
    	}
    	if (getcharid(0) == getpartyleader(.@party_id,2))
    		.@menu$ = "Generate Instance";
    	switch( select( .@menu$, "Enter " + .@md_name$ + "", "Cancel" ) ) {
    	case 1:
    		switch( instance_create(.@md_name$) ) {
    		case -3:
    			dispbottom "Memorial Dungeon, '" + .@md_name$ + "' is already in progress.",0xFFFFFF;
    			end;
    		case -4:
    		case -2:
    		case -1:
    			mes "Party Name: " + .@p_name$;
    			mes "Party Leader: " + strcharinfo(0);
    			mes "^0000ff" + .@md_name$ + "^000000 - time gap generation failed.";
    			close;
    		}
    		end;
    	case 2:
    		switch( instance_enter(.@md_name$) ) {
    		case IE_OTHER:
    			mes "An unknown error has occurred.";
    			close;
    		case IE_NOINSTANCE:
    			mes "The time gap is not yet open.";
    			close;
    		case IE_NOMEMBER:
    			mes "Your body is not fit to enter the time gap. You won't be able to get in if you're not in a party.";
    			close;
    		case IE_OK:
    			mapannounce strnpcinfo(4), .@p_name$ + " party member " + strcharinfo(0) + " enters " + .@md_name$ + "",bc_map,"0x00ff99";
    			end;
    		}
    	case 3:
    		end;
    	}
    }

    The script create an instance attached to the party. All party member can enter.

    Tested this script, but it doesn't seem to be working.

    As I try to generate dungeon (As party leader and with members on party)

    1.png.819f7d953e5ec14b1d90d9cf59d836de.png

    As I try to enter the instance:

    2.png.22f194769e829623d62d6d569904cfdd.png

  5. Will check it out Capuche!

    I have made some progress with my current code and it now looks like this:

    prontera,154,187,5	script	bossniatest	100,{
    	
    	set .map$,"bossnia_01";
    	
    mes "would you like to enter bossnia?";
    next;
    if ( select ( "Yes", "No" ) == 2 ) {
    	mes "See you...";
    	close;
    }
    if ( getmapusers( "bossnia_01" ) ) {
    	mes "Sorry, but there are people there already.";
    	close;
    	
    }
    warpparty "bossnia_01",0,0,getcharid(1);
    deltimer strnpcinfo(0) +"::OnKick";
    initnpctimer;
    addtimer 2700000, strnpcinfo(0) +"::OnKick"; // time limit
    @timeused = gettimetick(2);
    end;
    
    	OnTimer600000: // 10 minutes
    	mapannounce .map$,"10 minutes have passed, you still have 35 minutes left!",0,0x1E90FF;
    	sleep2 600000;
    	mapannounce .map$,"20 minutes have passed, you still have 25 minutes left!",0,0x1E90FF;
    	sleep2 600000;
    	mapannounce .map$,"30 minutes have passed, you still have 15 minutes left!",0,0x1E90FF;
    	sleep2 600000;
    	mapannounce .map$,"40 minutes have passed, you only have 5 minutes left!",0,0x1E90FF;
    	sleep2 120000;
    	mapannounce .map$,"42 minutes have passed, you only have 3 minutes left!",0,0x1E90FF;
    	sleep2 120000;
    	mapannounce .map$,"You will be warped back in 1 minute!",0,0x1E90FF;
    		
    OnKick:
    if ( getmapusers( "bossnia_01" ) ) {
    	warpparty "SavePoint",0,0,getcharid(1);
    	
    stopnpctimer;
    end; 
    
    }
    }

    Could anything be improved?

  6. Hey everyone, I am trying to add an instance to my bossnia NPC. But I haven't had experiences in creating instances yet.

    Instead of just sending the players to the bossnia maps, the NPC will create an instance/timer and send the players to the map. When the time runs out (30 minutes) the party members will automatically get kicked out from the map. (I will be impossible to leave party and to enter without one).

    I have been searching the forums for some ideas and came up with this

    prontera,154,187,5	script	test5	100,{
    mes "would you like to enter Room 1 ?";
    next;
    if ( select ( "Yes", "No" ) == 2 ) {
    	mes "good bye then";
    	close;
    }
    if ( getmapusers( "guild_vs2" ) ) {
    	mes "sorry, a player is in the room";
    	close;
    	
    }
    warpparty "guild_vs2",0,0,getcharid(1);
    deltimer strnpcinfo(0) +"::OnKick";
    addtimer 10000, strnpcinfo(0) +"::OnKick"; // 10 seconds warp out
    @timeused = gettimetick(2);
    end;
    OnKick:
    if ( getmapusers( "guild_vs2" ) ) {
    	warpparty "SavePoint",0,0,getcharid(1);
    
    end; 
    
    }
    }

    This method works, but I would like it to be more user friendly and give the players a real-time timer of how long they have left in the map.

    Also, is there a way to announce for messages only for party members?

    Any suggestions?

    Thank you!

     

     

  7. Hey everyone, I know it's probably very simple. But I'm not sure on how to add them. (2013 client)

    Here is what I tried doing but had no success:

    Added the .bmp to /collection

    Added the item .bmp to /item

    Added de .act and .spr to /¾ÆÀÌÅÛ

    On import/item_db I wrote 

    31017,Yellow_Gem,Yellow Gem,3,600,,100,,,,,,,,,,,,,{},{},{}

    and finally system/iteminfo.lub

    		[31017] = {
    		unidentifiedDisplayName = "Yellow_Gem",
    		unidentifiedResourceName = "Yellow_Gem",
    		unidentifiedDescriptionName = {
    			"New item",
    			"^ffffff_^000000",
    			"Weight : ^77777710^000000"
    		},
    		identifiedDisplayName = "Yellow_Gem",
    		identifiedResourceName = "Yellow_Gem",
    		identifiedDescriptionName = {
    			"New item",
    			"^ffffff_^000000",
    			"Weight: ^77777710^000000"
    		},
    		slotCount = 0,
    		ClassNum = 0
    	},

    Am I missing something? 

    Thanks!

  8. I keep getting this error when giving permission to "configure". Due to this, I can't proceed the migration to a paid host.

    [root@intelig1-4 emulador]# ./configure
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking how to run the C preprocessor... gcc -E
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking minix/config.h usability... no
    checking minix/config.h presence... no
    checking for minix/config.h... no
    checking whether it is safe to define _EXTENSIONS_... yes
    checking whether make sets $(MAKE)... yes
    checking for gcc... (cached) gcc
    checking whether we are using the GNU C compiler... (cached) yes
    checking whether gcc accepts -g... (cached) yes
    checking for gcc option to accept ISO C89... (cached) none needed
    checking for g++... no
    checking for c++... no
    checking for gpp... no
    checking for aCC... no
    checking for CC... no
    checking for cxx... no
    checking for cc++... no
    checking for cl.exe... no
    checking for FCC... no
    checking for KCC... no
    checking for RCC... no
    checking for xlC_r... no
    checking for xlC... no
    checking whether we are using the GNU C++ compiler... no
    checking whether g++ accepts -g... no
    checking for ar... /usr/bin/ar
    checking whether byte ordering is bigendian... yes
    configure: error: bigendian is not supported... stopping

    The host doesn't know how to fix this, apparently they have installed an rAthena server in the past month and had no issues.

    I tried switching to a clean version of rAthena and the error still persists.

     

    Could anybody give me some assistance? Thank you!

     

  9. Hi all, I'm having an issue with special characters on my server (éóçê) etc...

    The funny thing is that it they bug out only on one of my handmade NPCs and also appears on the server screen.

    Screenshot of the issue.

     

    Could anyone help?

    Many thanks!

×
×
  • Create New...