Jump to content
  • 0

pomoc Saved position


Stellet

Dotaz

15 odpovědí na tuto otázku

Recommended Posts

  • 0


/* Je možné, že to nebude fungovať, robil som to narýchlo a z hlavy. Ak bude nejaký problém alebo potrebuješ ešte niečo, tak napíš. */


static Float:pP[3]; // Globálna premenná

/* Do OnPlayerCommandText */
if(!strcmp(cmdtext, "/savep", true)) // Uloží pozíciu, môžeš pridať podmienku či je admin, môžeš povoliť port atď..
{
GetPlayerPos(playerid, pP[0], pP[1], pP[2]);
return 1;
}

if(!strcmp(cmdtext, "/gotoport", true)) // Teleportuje hráča na pozíciu
{
SetPlayerPos(playerid, pP[0], pP[1], pP[2]);
return 1;
}

 

Link to comment
Share on other sites

  • 0


static bool PortState; // Globálna booleanová premenná

if(!strcmp(cmdtext, "/porton", true))
{
if(PortState == false) PortState = true; // Dovolíme hráčom použiť port
if(PortState == true) PortState = false; // Zakážeme hráčom použiť port
return 1;
}


/* Tým pádom sme urobili z dvoch príkazov jeden. */


/* Samozrejme musíme upraviť príkaz pomocou ktorého sa hráči teleportujú. */


if(!strcmp(cmdtext, "/gotoport", true)) // Teleportuje hráča na pozíciu
{
if(PortState == true) SetPlayerPos(playerid, pP[0], pP[1], pP[2]); // Teleportuje hráča ak je port povolený
else SendClientMessage(playerid, -1, "Port nie je povolený"); // Ak nie, tak mu to napíše správu
return 1;
}
Link to comment
Share on other sites

  • 0

 

 

if(!strcmp(cmdtext, "/porton", true))
{
if(PortState == false) PortState = true; // Dovolíme hráčom použiť port
if(PortState == true) PortState = false; // Zakážeme hráčom použiť port
return 1;
}

 

Tím pádem ve hře dám jen /porton a pak znovu a je vyplej ? pomocí jednoho příkazu ?

Link to comment
Share on other sites

  • 0

 

public OnPlayerText(playerid, text[])
{
    return 1;
}

static Float:pP[3];
static bool PortState;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/ulozport", cmdtext, true, 10) == 0)
    {
        GetPlayerPos(playerid, pP[0], pP[1], pP[2]);
        return 1;
    }
    if (strcmp("/aport", cmdtext, true, 10) == 0)
    {
        if(PortState == true) SetPlayerPos(playerid, pP[0], pP[1], pP[2]);
        else SendClientMessage(playerid, -1, "Admin Port je vypnut");
    }
    if (strcmp("/aporton", cmdtext, true, 10) == 0)
    {
        if(PortState == false) PortState = true;
        if(PortState == true) PortState = false;
        return 1;
    }
    return 0;
}

 

 

Errory:

 

 

C:\Documents and Settings\User\Plocha\Samp map editor 0.3e v1.2\pawno\port.pwn(90) : error 001: expected token: ";", but found "-identifier-"
C:\Documents and Settings\User\Plocha\Samp map editor 0.3e v1.2\pawno\port.pwn(90) : error 010: invalid function or declaration
C:\Documents and Settings\User\Plocha\Samp map editor 0.3e v1.2\pawno\port.pwn(101) : error 017: undefined symbol "PortState"
C:\Documents and Settings\User\Plocha\Samp map editor 0.3e v1.2\pawno\port.pwn(106) : error 017: undefined symbol "PortState"
C:\Documents and Settings\User\Plocha\Samp map editor 0.3e v1.2\pawno\port.pwn(106) : error 017: undefined symbol "PortState"
C:\Documents and Settings\User\Plocha\Samp map editor 0.3e v1.2\pawno\port.pwn(106) : warning 215: expression has no effect
C:\Documents and Settings\User\Plocha\Samp map editor 0.3e v1.2\pawno\port.pwn(107) : error 017: undefined symbol "PortState"
C:\Documents and Settings\User\Plocha\Samp map editor 0.3e v1.2\pawno\port.pwn(107) : error 017: undefined symbol "PortState"
C:\Documents and Settings\User\Plocha\Samp map editor 0.3e v1.2\pawno\port.pwn(107) : warning 215: expression has no effect
C:\Documents and Settings\User\Plocha\Samp map editor 0.3e v1.2\pawno\port.pwn(247) : warning 203: symbol is never used: "bool"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


7 Errors.
Link to comment
Share on other sites

  • 0
static Float:pP[3];
static bool:PortState;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/ulozport", cmdtext, true, 10) == 0)
    {
        GetPlayerPos(playerid, pP[0], pP[1], pP[2]);
        return 1;
    }
    if (strcmp("/aport", cmdtext, true, 10) == 0)
    {
        if(PortState == true) SetPlayerPos(playerid, pP[0], pP[1], pP[2]);
        else SendClientMessage(playerid, -1, "Admin Port je vypnut");
    }
    if (strcmp("/aporton", cmdtext, true, 10) == 0)
    {
        if(PortState == false) PortState = true;
        if(PortState == true) PortState = false;
        return 1;
    }
    return 0;
}

Toto ti musí fungovať, mne to funguje.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...