Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
shapeshifting

pomoc AFK System pomoc

Recommended Posts

Dobrý večer / deň chcel by som sa Vás spýtať či by ste mi nepomohli s týmto errorom :)

ERROR:

C:\Users\Domov\Desktop\PawnoGW.pwn(221) : error 017: undefined symbol "cmdtext"
C:\Users\Domov\Desktop\PawnoGW.pwn(221) : warning 215: expression has no effect
C:\Users\Domov\Desktop\PawnoGW.pwn(221) : error 001: expected token: ";", but found "]"
C:\Users\Domov\Desktop\PawnoGW.pwn(221) : error 029: invalid expression, assumed zero
C:\Users\Domov\Desktop\PawnoGW.pwn(221) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

 

Pawno Súbor:

#include <a_samp>
#include <izcmd>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#if defined FILTERSCRIPT
#define BARVA_SEDA      0xAFAFAFAA
#define BARVA_BILA      0xEFEFF7AA
#define BARVA_ZLTA      0xF5F557FF

forward PovolitAFK(playerid);
forward KontrolaPozice();

new bool:AFK[MAX_PLAYERS];
new OldAFK[MAX_PLAYERS];
new UlozeneJmeno[MAX_PLAYERS][MAX_PLAYER_NAME]
new Float:SaveX[MAX_PLAYERS],SaveY[MAX_PLAYERS],Float:SaveZ[MAX_PLAYERS];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" GangWar 1.0");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    SetGameModeText("GangWar 1.0");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    SetTimer("KontrolaPozice",60000,1);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

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

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

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        return 1;
    }
    return 0;
}

public OnPlayerInfoChange(playerid)
{
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

    CMD:heal(playerid,params[])
    {
        SetPlayerHealth(playerid,100);
        SetPlayerArmour(playerid,100);
        SendClientMessage(playerid,0xF5F557FF,"Úspešne si sa doplnil životy!");
        return 1;
    }
    CMD:lv(playerid,params[])
    {
        SetPlayerPos(playerid,2163.4778,1421.3873,10.8203);
        SendClientMessage(playerid,0xF5F557FF,"Úspešne si sa odwarpoval do Las Venturas!");
        return 1;
    }
    CMD:sf(playerid,params[])
    {
        SetPlayerPos(playerid,-1944.3771,577.4300,35.1719);
        SendClientMessage(playerid,0xF5F557FF,"Úspešne si sa odwarpoval do San Fierra!");
        return 1;
    }
    CMD:ls(playerid,params[])
    {
        SetPlayerPos(playerid,1785.8093,-1696.0023,13.4720);
        SendClientMessage(playerid,0xF5F557FF,"Úspešne si sa odwarpoval do Los Santos!");
        return 1;
    }
    CMD:kill(playerid,params[])
    {
        SetPlayerHealth(playerid,0);
        SetPlayerArmour(playerid,0);
        SendClientMessage(playerid,0xF5F557FF,"Úspešne si spáchal samovraždu!");
        return 1;
    }
    CMD:afk(playerid,params[])
    {
        dcmd(afk,3, cmdtext);
        return 0;
    }

stock Jmeno(playerid)       // Stock ktorým zistíme meno hráča ( aby sme nepoužívali GETPLAYERNAME
{
new p[MAX_PLAYER_NAME]
if(IsPlayerConnected(playerid)) GetPlayerName(playerid,p,MAX_PLAYER_NAME);
return p;
}

public KontrolaPozice()
{
new Float:X,Float:Y,Float:Z;//promene do kterych budeme zapisovat
for(new i;i    {
    if(IsPlayerConnected(i))//vsechny obsazene sloty
    {
        GetPlayerPos(i,X,Y,Z);//zjistime pozici
        if(SaveX == X && SaveY == Y && SaveZ == Z)
        {
            if(AFK == false) dcmd_afk(i," ");//kdyz bude na stejnych radkach jako minule a nebude afk tak ho dame ho do afk
        }
        //ulozime pro dalsi hodnoceni
        SaveX = X;
        SaveY = Y;
        SaveZ = Z;
        }
}
return 1;
}

dcmd_afk(playerid,params[])//odeslan callback z OnPlayerCommandText
{
   if(IsPlayerConnected(playerid))
{
    new string[128];//promena do ktere si budeme zapisovat texty
        if(AFK[playerid] == false)//kdyz hrac neni AFK
         {
             if(OldAFK[playerid] != 0)//kdyz neubehlo 10 sekund od vraceni k pocitaci
             {
                 format(string,sizeof(string),"[ ! ] Tento prikaz muzete pouzit az za %d sekund",OldAFK[playerid]);//dosadime si do spravy
                 SendClientMessage(playerid,BARVA_BILA,string);//odesleme
                 return 1;//zastavime prkaz
        }
        else if(strlen(params) == 0)//kdyz uz ubehlo 10 sekund od navraceni a nezada zadny duvod za afk proste jenom ciste prikaz /afk
        {
            if(!VolneOkoli(playerid)) return SendClientMessage(playerid,BARVA_BILA,"[ ! ] Ve vasi blizkosti je nejaky hrac !");//public vysvetlen nize
            format(string,sizeof(string),"[ AFK ] Hráč %s odešel na chvíli od PC !",Jmeno(playerid));//dosadime spravu
            SendClientMessageToAll(BARVA_SEDA,string);//odesleme
            TogglePlayerControllable(playerid,0);//smzarime
            AFK[playerid] = true;//dame promenou aby sme vedeli ze je afk
            SendClientMessage(playerid,BARVA_BILA,"Pro navrat /afk");//aprava aby vedel ja  k se vratit
            format(UlozeneJmeno[playerid],MAX_PLAYER_NAME,Jmeno(playerid));//ulozime si hracovo jmeno
            new name[MAX_PLAYER_NAME];//promena do ktere ulozime nove jmeno
            format(name,MAX_PLAYER_NAME,"[AFK]%s",Jmeno(playerid));//pred jeho jmeno pridame [AFK]
            SetPlayerName(playerid,name);//zmenime jmeno
             }else{//kdyz zada nejaky duvod treba /afk du na WC
               if(!VolneOkoli(playerid)) return SendClientMessage(playerid,BARVA_BILA,"[ ! ] Ve vasi blizkosti je nejaky hrac !");
            format(string,sizeof(string),"[ AFK ] Hráč %s odešel na chvíli od PC ! [ Důvod: %s ]",Jmeno(playerid),params);//zase dosadiem ale uz s duvodem .. dal uz to znate..
            SendClientMessageToAll(BARVA_SEDA,string);
            TogglePlayerControllable(playerid,0);
            AFK[playerid] = true;
            SendClientMessage(playerid,BARVA_BILA,"Pro navrat /afk");
            format(UlozeneJmeno[playerid],MAX_PLAYER_NAME,Jmeno(playerid));
            new name[MAX_PLAYER_NAME];
            format(name,MAX_PLAYER_NAME,"[AFK]%s",Jmeno(playerid));
            SetPlayerName(playerid,name);
        }
    }
         else if(AFK[playerid] == true)//kdyz je afk
         {
           format(string,sizeof(string),"[ AFK ] Hráč %s je zpět ve hře !",Jmeno(playerid));//zase dosadime spravu
        SendClientMessageToAll(BARVA_SEDA,string);//odesleme
        TogglePlayerControllable(playerid,1);//rozmrazime
        SetPlayerName(playerid,UlozeneJmeno[playerid]);//vratime jeho jmeno
        AFK[playerid] = false;//promena aby sme vedeli ze uz neni afk
        OldAFK[playerid] = 10;//promena ze ktere budeme odecitat kazdou sekundu
        SetTimerEx("PovolitAFK",1000,0,"i",playerid);//a timer ve kterem budeme odecitat
       }
   }
return 1;
}

public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
//jako u prikazu afk akorat kdyz stiskne jakoukoli klavesu ktera je definovana pawnem
   if(AFK[playerid] == true)
{
    new string[128];
    format(string,sizeof(string),"[ AFK ] Hráč %s je zpět ve hře !",Jmeno(playerid));
         SendClientMessageToAll(BARVA_SEDA,string);
       TogglePlayerControllable(playerid,1);
       SetPlayerName(playerid,UlozeneJmeno[playerid]);
    AFK[playerid] = false;
    OldAFK[playerid] = 10;
    SetTimerEx("PovolitAFK",1000,0,"i",playerid);
}
return 1;
}

public PovolitAFK(playerid)//public ktery si vyvolavame sekundovym tiemrem
{
OldAFK[playerid]--;//odesmete promenou
if(OldAFK[playerid] > 0) SetTimerEx("PovolitAFK",1000,0,"i",playerid);//kdyz promena nebdue nula pustime public
return 1;
}

stock VolneOkoli(playerid)
{
for(new i;i    {
    if(IsPlayerConnected(i))//obsazene id
    {
        if(DistanceBTWPlayers(playerid,i) < 10) return 0;// kdyz bude nekdo blize jak 10 jednotek odesleme do podminky hodnotu nula
    }
}
return 1;//kdyz nebude nidko poblic odesleme hodnotu 1
}

 

Robil som si to podľa ATomasa takže som si tam napísal aj tie poznámky čo tam mal :) 

Ďakujem za všetko!

Sdílet tento příspěvek


Link to post
Share on other sites

new bool:AFK[MAX_PLAYERS];
new OldAFK[MAX_PLAYERS];
new UlozeneJmeno[MAX_PLAYERS][MAX_PLAYER_NAME];
new Float:SaveX[MAX_PLAYERS],SaveY[MAX_PLAYERS],Float:SaveZ[MAX_PLAYERS];

 

nemal si tam ; , ďalej som zatiaľ ani nepozeral...

 

Edit:

 

stock Jmeno(playerid)       // Stock ktorým zistíme meno hráča ( aby sme nepoužívali GETPLAYERNAME
{
new p[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid)) GetPlayerName(playerid,p,MAX_PLAYER_NAME);

return p;
}

ďalšia chyba...

Ďalej: vytváraš príkaz v príkaze...fakt nerozumiem ako si k tomuto došiel...  skús pozrieť pár návodov a porozmýšľať čo je tu zlé.

CMD:afk(playerid,params[])
    {
        dcmd(afk,3, cmdtext);
        return 0;

}

 

Edited by EEEE

Sdílet tento příspěvek


Link to post
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
Sign in to follow this  

×
×
  • Create New...