Teleport mit Geldabzug!

04/29/2014 03:05 Serenity-.#1
Kann mir jemand sagen wie ich meinen Teleporter erweitern kann so das er pro teleport geld abzieht.

habe den mit Bildern.

Ich glaube das muss man hier irgendwie machen

strFile = "flaris.tga";
strLandName ="Flaris";
strDes= "Flaris ist die Stadt, in der jeder mal angefangen hat.";
m_nCost.push_back(10000);
Beim Compilen kommt ein Error deshalb gehe ich davon aus das es falsch ist :D
break;
04/29/2014 10:28 Avalion#2
You would want to define the vector, m_nCost or you would just want to alternate prices using the same variable. I suggest the second. Also, you should do prices in WorldServer rather than the neuz. Sure, to display the price, you could add another string for penya cost in the neuz, in that function.

Anyway, void CDPSrvr::OnTeleportByAPP( CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE, u_long ) is a place where you could do it perfectly. In fact, since you looked at the Tower for pricing (m_nCost.push_back), just look at the tower in the Worldserver. You'd want to define the money variable and then set prices to each one, and remove the gold.

CDPSrvr::OnTeleportByAPP
Code:
        ar >> nCurSel;
        DWORD dwWorldID;
        D3DXVECTOR3 vPos;
        int nCost = 0;
        switch( nCurSel )
        {
            case 0: vPos = D3DXVECTOR3(6973.0F, 100.0F, 3328.0F); dwWorldID = 1; nCost = 1000; break;
        }
	if( pUser->GetGold() < nCost )
	{
		pUser->AddDefinedText( TID_GAME_LACKMONEY );
		return;
	}
	if(pUser->REPLACE( g_uIdofMulti, dwWorldID, vPos, REPLACE_NORMAL, nDefaultLayer ))
	{
		pUser->AddGold( -nCost );
		PutPenyaLog( pUser, "h", "Costed", nCost );
	}
04/29/2014 18:51 Serenity-.#3
errors...

This is my Teleporter code.

Quote:
#ifdef __APP_TELEPORTER
void CDPSrvr::OnTeleportByAPP( CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE, u_long )
{
#ifdef __NEW_DEBUG
g_Guard.LogDebug("CDPSrvr::OnTeleportByAPP");
#endif
CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
int nCurSel;
if( IsValidObj( pUser ) )
{
ar >> nCurSel;
DWORD dwWorldID;
D3DXVECTOR3 vPos;
switch( nCurSel )
{
case 0: vPos = D3DXVECTOR3(6973.0F, 100.0F, 3328.0F); dwWorldID = 1; break;
case 1: vPos = D3DXVECTOR3(8321.0F, 100.0F, 3720.0F); dwWorldID = 1; break;
case 2: vPos = D3DXVECTOR3(3900.250732F, 59.0F, 4377.806641F); dwWorldID = 1; break;
case 3: vPos = D3DXVECTOR3(5574.530273F, 75.001129F, 3900.282227F); dwWorldID = 1; break;
case 4: vPos = D3DXVECTOR3(3240.482910F, 11.316653F, 3409.634766F); dwWorldID = 1; break;
case 5: vPos = D3DXVECTOR3(1403.403809F, 86.612137F, 514.367432F); dwWorldID = 206; break;
04/29/2014 18:59 Drabur#4
This is the problem if you use a teleporter like this. You can create a teleporter with a resource file.
04/30/2014 16:10 .SnoX#5
Quote:
Originally Posted by Serenity-. View Post
errors...

This is my Teleporter code.
Du musst doch nur sowas hier eingeben über deinem pUser->REPLACE

Quote:
int nCost = 300000; // 300k Penya
if( pUser->GetGold() < nCost )
{
pUser->AddText( "Du hast nicht genügend Penya...." );
return;
}
pUser->AddGold( -nCost );
05/01/2014 00:50 Avalion#6
Quote:
Originally Posted by .SnoX View Post
Du musst doch nur sowas hier eingeben über deinem pUser->REPLACE
The version I posted works and allows different prices for each teleport.
Die Version, die ich habe Werke. Es erlaubt einen anderen Preis für verschiedene Orte.
05/01/2014 03:12 .SnoX#7
Quote:
Originally Posted by Avalion View Post
The version I posted works and allows different prices for each teleport.
Die Version, die ich habe Werke. Es erlaubt einen anderen Preis für verschiedene Orte.
Please dont wirte en german aggain haha.
I know that you posted it but the thread owner didn't understand it, so I repeated it again.