Jump to content
  • 0

pomoc Firmy


[Hades]

Dotaz

Popis problému:

ahoj delam si firmy a potrebuji poradit vse slape jak ma ale problem je v Create3DTextLabel kdyz koupim dum neukaze se majitel ale stale je tam mesto uz me to stve celej den predem diky za rady

 

Chyby/varování kompilátoru a při běhu:

--

 

Kód:

 

#include 

//-----[ Define ]-----|
#define MAX_PROPERTY      100
#define MAX_PROPERTY_NAME 50
//--------------------|

//-----[ Enum & New ]-----|
enum PROPERTY_INFO
{
Ne_Cena,
Float:Ne_X,
Float:Ne_Y,
Float:Ne_Z,
Ne_Majitel[MAX_PROPERTY_NAME],
Ne_Dialog,
Ne_Majitela,
Ne_iDialog,
PlatNemovitost,
Ne_Pickup
};
new NemovitostInfo[MAX_PROPERTY][PROPERTY_INFO];
new CountProperty = 0;
new MajitelN[MAX_PROPERTY][MAX_PLAYERS];
//------------------------|

//-----[ Forward ]-----|
forward VyplataNemovitosti(playerid);
forward MultiiTimer(playerid);
forward GetPlayerDistanceToPointEx(playerid,Float:x,Float:y,Float:z);
forward IsPlayerInSphere(playerid,Float:x,Float:y,Float:z,radius);
forward AddStaticProperty(const Pr_Name[], Float:Pr_X, Float:Pr_Y, Float:Pr_Z, Pr_Cena, Pr_Dialog, Pr_iDialog);
//---------------------|


//______________________________________________________________________________

public AddStaticProperty(const Pr_Name[], Float:Pr_X, Float:Pr_Y, Float:Pr_Z, Pr_Cena, Pr_Dialog, Pr_iDialog)
{
if(CountProperty < MAX_PROPERTY)
{

format(NemovitostInfo[CountProperty][Ne_Majitel], MAX_PROPERTY_NAME, "%s", Pr_Name);
NemovitostInfo[CountProperty][Ne_Cena]     = Pr_Cena;
NemovitostInfo[CountProperty][Ne_X]        = Pr_X;
NemovitostInfo[CountProperty][Ne_Y]        = Pr_Y;
NemovitostInfo[CountProperty][Ne_Z]        = Pr_Z;
NemovitostInfo[CountProperty][Ne_Dialog]   = Pr_Dialog;
NemovitostInfo[CountProperty][Ne_iDialog]   = Pr_iDialog;
NemovitostInfo[CountProperty][Ne_Majitela] = 0;
NemovitostInfo[CountProperty][PlatNemovitost] = 0;
NemovitostInfo[CountProperty][Ne_Pickup] = CreatePickup(1273,1,Pr_X,Pr_Y,Pr_Z);
CountProperty ++;
} else {
printf("Je vysoký počet nemovitostí, je jich %d, a MAXimalne je %d !", CountProperty, MAX_PROPERTY);
}
}
//==============================================================================
public IsPlayerInSphere(playerid,Float:x,Float:y,Float:z,radius)
{
if(GetPlayerDistanceToPointEx(playerid,x,y,z) < radius) return 1;
return 0;
}
//==============================================================================
public GetPlayerDistanceToPointEx(playerid,Float:x,Float:y,Float:z)
{
new Float:x1,Float:y1,Float:z12,Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z12);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)
+floatpower(floatabs(floatsub(y,y1)),2)+floatpower(floatabs(floatsub(z,z12)),2));
return floatround(tmpdis);
}
//==============================================================================
public MultiiTimer(playerid)
{
for(new p = 0; p< CountProperty; p++)
{
if(IsPlayerInSphere(playerid, NemovitostInfo[p][Ne_X], NemovitostInfo[p][Ne_Y] ,NemovitostInfo[p][Ne_Z], 2) == 1)
    {
        SendClientMessage(playerid, 0xFF0000FF, "L.ALT k zobrazeni menu nemovitosti.");
    }
}
}
//==============================================================================
public VyplataNemovitosti(playerid)
{
    SendClientMessage(playerid, 0xFF0000FF, "[    $    ]: Nemovitosti byli vyplaceny !");
for(new p = 0; p < CountProperty; p ++)
    {
        if(MajitelN[p][playerid] == 1)
            {
                NemovitostInfo[p][PlatNemovitost] += NemovitostInfo[p][Ne_Cena];
            }
    }
}
//==============================================================================
public OnFilterScriptInit()
{
SetTimer("MultiiTimer", 100, 1);
SetTimer("VyplataNemovitosti", 60000*5, 1);
//----------|
AddStaticProperty("Firma", 2164.0728,1410.5341,10.8203, 3, 650, 651);
//----------|
for(new p = 0; p< CountProperty; p++)
{
    new stringEX[100];
            new pstring[100];
new buyyng[150];

format(pstring,sizeof(pstring),"Majitel:%s \nCena: %d",NemovitostInfo[p][Ne_Majitela] = 0,NemovitostInfo[p][Ne_Cena]);
Create3DTextLabel(pstring,  0x0000BBAA,NemovitostInfo[p][Ne_X], NemovitostInfo[p][Ne_Y] ,NemovitostInfo[p][Ne_Z], 40.0, 0, 0);
format(buyyng, 150,"Majitel:%s \nCena: %d$",NemovitostInfo[p][Ne_Majitela] = 0, NemovitostInfo[p][Ne_Cena]);
Create3DTextLabel(buyyng,0x00FF00FF,NemovitostInfo[p][Ne_X], NemovitostInfo[p][Ne_Y] ,NemovitostInfo[p][Ne_Z] + 1,80.0,0);
}
//----------|
return 1;
}
//==============================================================================
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_WALK)
{
for(new p=0; p< CountProperty; p++)
{
if(IsPlayerInSphere(playerid, NemovitostInfo[p][Ne_X], NemovitostInfo[p][Ne_Y] ,NemovitostInfo[p][Ne_Z], 2) == 1)
     {
ShowPlayerDialog(playerid, NemovitostInfo[p][Ne_Dialog] , DIALOG_STYLE_LIST, "Nemovitost", "Koupit\nInvestovat\nProdat\nInformace\nVybrat plat z nemovitosti", "Potvrdit", "Nic");
}
}
}
return 1;
}
//==============================================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
for(new p = 0; p< CountProperty; p++)
{
if(dialogid == NemovitostInfo[p][Ne_Dialog])
    {
       if(response == 1)
       {
          if(listitem == 0)
          {
         if(GetPlayerMoney(playerid) < NemovitostInfo[p][Ne_Cena]) return SendClientMessage(playerid, 0xFF0000FF, "Nemas dostatek penez !");
                        if(NemovitostInfo[p][Ne_Majitela] == 1) return SendClientMessage(playerid, 0xFF0000FF, "Tuto nemovitost už někdo vlastní !");
MajitelN[p][playerid] = 1;
            NemovitostInfo[p][Ne_Majitela] = 1;
            GivePlayerMoney(playerid, -NemovitostInfo[p][Ne_Cena]);
            SendClientMessage(playerid, 0xFF0000FF, "Koupil jsi si nemovitost !");
            DestroyPickup(NemovitostInfo[p][Ne_Pickup]);
NemovitostInfo[p][Ne_Pickup] = CreatePickup(1272,1,NemovitostInfo[p][Ne_X], NemovitostInfo[p][Ne_Y] ,NemovitostInfo[p][Ne_Z]);
          }
         else if(listitem == 1)
             {
                 if(MajitelN[p][playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "Tato nemovitost není tvá !");
                 ShowPlayerDialog(playerid,NemovitostInfo[p][Ne_iDialog],DIALOG_STYLE_INPUT,"Investace","Napiš kolik chceš do své nemovitosti investovat:","Investovat","Nic");
             }
         else if(listitem == 2)
             {
                 if(MajitelN[p][playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "Tato nemovitost není tvá !");
                 MajitelN[p][playerid] = 0;
                 NemovitostInfo[p][Ne_Majitela] = 0;
                 SendClientMessage(playerid, 0xFF0000FF, "Peníze z nemovitosti ti byli vráceny !");
                 GivePlayerMoney(playerid, NemovitostInfo[p][Ne_Cena]);
                 DestroyPickup(NemovitostInfo[p][Ne_Pickup]);
NemovitostInfo[p][Ne_Pickup] = CreatePickup(1273,1,NemovitostInfo[p][Ne_X], NemovitostInfo[p][Ne_Y] ,NemovitostInfo[p][Ne_Z]);
             }
         else if(listitem == 3)
             {
                 SendClientMessage(playerid, 0xFF0000FF, "           [         Property         ]");
                 //---------|
                 new string[150];
                 format(string, 150, "Jméno Nemovitosti: %s", NemovitostInfo[p][Ne_Majitel]);
                 SendClientMessage(playerid, 0xFFFFFFFF, string);
                 new cena[150];
                 format(cena, 150, "Cena nemovitosti: %d$", NemovitostInfo[p][Ne_Cena]);
                 SendClientMessage(playerid, 0xFFFFFFFF, cena);
                 if(NemovitostInfo[p][Ne_Majitela] == 0) SendClientMessage(playerid, 0xFFFFFFFF, "Nemovitost: K pronájmu");
                 else if(NemovitostInfo[p][Ne_Majitela] == 1) SendClientMessage(playerid, 0xFFFFFFFF, "Nemovitost: Odkoupena");
                 //---------|
                 SendClientMessage(playerid, 0xFF0000FF, "_______________________________________");
             }
else if(listitem == 4)
{
    if(MajitelN[p][playerid] == 0)    return SendClientMessage(playerid, 0xFF0000FF, "Tato nemovitost není tvá !");
    if(NemovitostInfo[p][PlatNemovitost] < 1) return SendClientMessage(playerid, 0xFF0000FF, "Tato nemovitost nema v sobě ani dolar !");
    GivePlayerMoney(playerid, NemovitostInfo[p][PlatNemovitost]);
    NemovitostInfo[p][PlatNemovitost] = 0;
    SendClientMessage(playerid, 0xFF0000FF, "Dostal jsi peníze !");
}
       }
    }
if(dialogid == NemovitostInfo[p][Ne_iDialog])
{
       if(response == 1)
       {
           new string[150];
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,NemovitostInfo[p][Ne_iDialog],DIALOG_STYLE_INPUT,"Investace","Musíš napsat částku !:","Investovat","Nic");
           NemovitostInfo[CountProperty][Ne_Cena] += strval(inputtext);
           format(string, 150, "Zvíšil jsi cenu nemovitosti na %d$ !", NemovitostInfo[CountProperty][Ne_Cena]);
           SendClientMessage(playerid, 0xFF0000FF, string);
       }
    }
}
return 1;
}
//==============================================================================

 

 

 

Dodatečné poznámky:

--

Link to comment
Share on other sites

1 odpověd na tuto otázku

Recommended Posts

  • 0

Keď zavoláš Create3DTextLabel, ulož si vrátenú hodnotu (ID vytvoreného 3D textu) ideálne do poľa NemovitostInfo (do enumu PROPERTY_INFO pridáš Ne_Text). Túto hodnotu potom použiješ v Update3DTextLabelText, link na wiki: http://wiki.sa-mp.com/wiki/Update3DTextLabelText.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...