[Pomoc] Nece da mi ucitava komande

Započeo xzeL, Januar 20, 2011, 13:06:07 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Evo napokon riješim problem sa svim....i sada radim komande uradim makeadmin cudi me nece da radi...kontam ja sam pogrijesio ponovo uradim opet nece...kopiram komandu iz GF moda jer je potpuno po istom sistemu radjeno opet..nece...znaci nemam niti jednog warninga niti errora u MODU a nece da mi ocitaje komande :S...mozetel mi reci zasto?
Poslednja Izmena: Januar 20, 2011, 15:15:15 POSLE PODNE od [Saw]BloodMaster


aj ti zavezi..ako ne zelis pomoci nemoj postati u temi..nisi ti zaduzen za to....

Ako je server na kucnom hostu provjeri jesi li ga ugasio pa opet upalio(resetirao).

Jesam sve sam provjerio i neece da mi komande ucita da si xD...

cristiane

Bilo je vec ovih pitanja potrazi al evo ti jedan nacin vjerovatno si ubacio neku FS koja se ne uklapa na tvoj mode,izbrisi je pa probaj

black_dota

mozda si dodao #include <zcmd> a koristis komande u cmd?

Citat: xzeL poslato Januar 20, 2011, 13:06:07 POSLE PODNE
Evo napokon riješim problem sa svim....i sada radim komande uradim makeadmin cudi me nece da radi...kontam ja sam pogrijesio ponovo uradim opet nece...kopiram komandu iz GF moda jer je potpuno po istom sistemu radjeno opet..nece...znaci nemam niti jednog warninga niti errora u MODU a nece da mi ocitaje komande :S...mozetel mi reci zasto?


A da nam das komandu? Ili tak nes da mi vidimo...

Jbt, nismo vidovnjaci :)

Moze biti milion razloga :)

- Nisi copilo
- Mozda nisi se stavio za admina
- neda mi se pisat (;

Citat: xzeL poslato Januar 20, 2011, 13:29:09 POSLE PODNE
aj ti zavezi..ako ne zelis pomoci nemoj postati u temi..nisi ti zaduzen za to....

Zasto si bahat? Covjek te ljepo uputi da procitas pravila jer je ime teme netocno ^^

Citat: xzeL poslato Januar 20, 2011, 13:29:09 POSLE PODNE
nisi ti zaduzen za to....

Svi smo mi zaduzeni da pomognemo i uputimo na bolji put....

Imam zcmd include sad cemo probat bez njeg :D



Edit nije do zcmd obriso sam ga i opet nece...


Komanda je iz GF moda...


Admin sistem iz GF moda...ni jednu komandu nece nit obicnu kad napravim..neznam zasto evo pa vidite poslat cu vam cijeli MOD...




#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>
#include <utils>
#include <morphinc>
#include <dini>

#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney

#define registeR 6
#define logiN 7
#define ZELENA 0x9EC73DAA

#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_DBLUE 0x2641FEAA
#define COLOR_ALLDEPT 0xFF8282AA
#define COLOR_NEWS 0xFFA500AA
#define COLOR_OOC 0xE0FFFFAA


forward ini_GetKey( line[] );
forward ini_GetValue( line[] );
forward OnPlayerLogin(playerid,password[]);
forward OnPlayerRegister(playerid, password[]);
forward OnPlayerUpdateVirt(playerid);
forward SendAdminMessage(color, string[]);
forward ABroadCast(color,const string[],level);

enum pInfo
{
pSifra[64],
pAdmin
};

new PlayerInfo[MAX_PLAYERS][pInfo];
new IsLogged[MAX_PLAYERS];
new IsRegistered[MAX_PLAYERS];
new IsDialogShown[MAX_PLAYERS];
new PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
new Cash[MAX_PLAYERS];
new gPlayerLogged[MAX_PLAYERS];

forward MoneyTimer();

main(){}

public OnGameModeInit()
{
SetGameModeText("-Virtuality RP-");
    SetTimer("MoneyTimer", 1000, 1);
    AddStaticVehicle(533,1928.5809,-2141.8679,13.2711,180.8996,0,0); // polaganje 1
AddStaticVehicle(533,1931.7637,-2142.0027,13.2710,178.3861,0,0); // polaganje 2
AddStaticVehicle(533,1938.1743,-2142.0215,13.2702,181.5772,0,0); // polaganje 3
AddStaticVehicle(533,1941.4484,-2141.9814,13.2662,181.8750,0,0); // polaganje 4
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
TogglePlayerSpectating(playerid, 1);
return 1;
}

public MoneyTimer()
{
    new username[MAX_PLAYER_NAME];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerCash(i) != GetPlayerMoney(i))
            {
                ResetMoneyBar(i);//Reseta novac u originalni bar
                UpdateMoneyBar(i,GetPlayerCash(i));//Stavljanje igracevog novca na 0
                new hack = GetPlayerMoney(i) - GetPlayerCash(i);
                GetPlayerName(i,username,sizeof(username));
                printf("%s je pokusao spawnati $%d.", username,hack);
            }
        }
    }
}

// ######################### KOMANDE - START #########################


// ######################### KOMANDE - STOP ##########################

public OnPlayerConnect(playerid)
{
    ResetPlayerCash(playerid);
    new file[64];
IsLogged[playerid] = 0;
IsRegistered[playerid] = 0;
IsDialogShown[playerid] = 0;
PlayerInfo[playerid][pAdmin] = 0;
GetPlayerName(playerid, PlayerName[playerid], MAX_PLAYER_NAME);
format(file, sizeof(file), "%s.ini", PlayerName[playerid]);
if(fexist(file)) { IsRegistered[playerid] = 1; } else { IsRegistered[playerid] = 0; }
return 1;
}

public OnPlayerUpdate(playerid)
{
new string[128];
    if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && IsDialogShown[playerid] == 0)
{
if(IsRegistered[playerid] > 0)
{
    IsDialogShown[playerid] = 1;
    format(string,sizeof string, "Dobrodosli, %s! \n Vas racun je registrovan.\nMolimo vas ulogujte se!", PlayerName[playerid]);
ShowPlayerDialog(playerid, logiN, DIALOG_STYLE_INPUT, "Racun", string, "Uloguj se!", "Odustani");
}
else
{
            IsDialogShown[playerid] = 1;
    format(string,sizeof string, "Dobrodosli, %s! \nVas racun nije registrovan.\nMolimo vas da registrujete svoj racun!",PlayerName[playerid]);
    ShowPlayerDialog(playerid, registeR, DIALOG_STYLE_INPUT, "Racun", string, "Registruj se!", "Odustani");
}
}
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new tmppass[64];
if(dialogid == registeR)
{
if(response)
{
    new file[64];
    new string[128];
    format(file,sizeof(file),"%s.ini",PlayerName[playerid]);
if(strlen(inputtext) == 0)
{
format(string, sizeof string, "Molimo vas da ukucate sifru \n\nDobrodosli %s! \nVas racun nije registrovan \n\nMolimo vas da registrujete svoj racun!", PlayerName[playerid]);
ShowPlayerDialog(playerid, registeR, DIALOG_STYLE_INPUT, "Racun", string, "Registruj se!", "Odustani");
OnPlayerRegister(playerid,tmppass);
return 1;
}
if(!fexist(file))
{
dini_Create(file);
dini_Set(file, "Sifra", inputtext);
dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][pAdmin]);
format(string, sizeof string, "Racun je registrovan \n\nDobrodosli %s! \nVas racun je registrovan. \n\nMolimo vas da se ulogujete!", PlayerName[playerid]);
ShowPlayerDialog(playerid, logiN, DIALOG_STYLE_INPUT, "Racun", string, "Uloguj se!", "Odustani");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
OnPlayerLogin(playerid,tmppass);
}
}
else
{
    Kick(playerid);
}
}
if(dialogid == logiN)
{
if(response)
{
    new file[64];
    new string[128];
    format(file,sizeof(file),"%s.ini",PlayerName[playerid]);
if(strlen(inputtext) == 0)
{
    format(string, sizeof string, "Molimo vas da ukucate sifru \n\n %s! \nVas racun je registrovan \n\nMolimo vas da se ulogujete!", PlayerName[playerid]);
ShowPlayerDialog(playerid, logiN, DIALOG_STYLE_INPUT, "Racun", string, "Uloguj se!", "Odustani");
return 0;
}
if(fexist(file))
{
    if(strcmp(dini_Get(file, "Sifra"), inputtext, true ) == 0)
{
IsLogged[playerid] = 1;
SendClientMessage(playerid, 0xFFE87DFF, "Uspesno ste se ulogovali");
TogglePlayerSpectating(playerid, 0);
}
else
{
    SendClientMessage(playerid, 0xAA3333AA, "GRESKA - Pogresna sifra");
    Kick(playerid);
}
}
}
}
    return 1;
}

stock GivePlayerCash(playerid, money)
{
    Cash[playerid] += money;
    ResetMoneyBar(playerid);//Reseta novac u originalni bar
    UpdateMoneyBar(playerid,Cash[playerid]);//Stavlja novac u originalni bar
    return Cash[playerid];
}
stock SetPlayerCash(playerid, money)
{
    Cash[playerid] = money;
    ResetMoneyBar(playerid);//Reseta novac u originalni bar
    UpdateMoneyBar(playerid,Cash[playerid]);//Stavlja novac u originalni bar
    return Cash[playerid];
}
stock ResetPlayerCash(playerid)
{
    Cash[playerid] = 0;
    ResetMoneyBar(playerid);//Reseta novac u originalni bar
    UpdateMoneyBar(playerid,Cash[playerid]);//Stavlja novac u originalni bar
    return Cash[playerid];
}
stock GetPlayerCash(playerid)
{
    return Cash[playerid];
}

public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid, 1929.8484,-2135.2734,13.6953);
return 1;
}


public OnPlayerLogin(playerid,password[])
{
    new string2[64];
new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "%s.ini", playername2);
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
    new PassData[256];
    new keytmp[256], valtmp[256];
    fread( UserFile , PassData , sizeof( PassData ) );
    keytmp = ini_GetKey( PassData );
    if( strcmp( keytmp , "Key" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][pSifra], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][pSifra],password, true ) == 0 )
{
    new key[ 256 ] , val[ 256 ];
    new Data[ 256 ];
    while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
                }//end while
                fclose(UserFile);//close the file after everything has been read in the while
}
if (PlayerInfo[playerid][pAdmin] > 0)
{
format(string2, sizeof(string2), "SERVER: You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_WHITE,string2);
}
}
return 1;
}

stock ini_GetKey( line[] )
{
new keyRes[256];
keyRes[0] = 0;
    if ( strfind( line , "=" , true ) == -1 ) return keyRes;
    strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
    return keyRes;
}

stock ini_GetValue( line[] )
{
new valRes[256];
valRes[0]=0;
if ( strfind( line , "=" , true ) == -1 ) return valRes;
strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
return valRes;
}

public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "%s.ini", playername3);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
    strmid(PlayerInfo[playerid][pSifra], password, 0, strlen(password), 255);
    new var[32];
format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
fclose(hFile);
SendClientMessage(playerid, COLOR_YELLOW, "Account registered, you can login now (/login [password]).");
}
}
return 1;
}

public OnPlayerUpdateVirt(playerid)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid])
{
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "%s.ini", playername3);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
new var[32];
format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
fclose(hFile);
}
}
}
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new cmd[256];
new tmp[256];
new idx;
cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/makeadmin", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level(1-3)]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
    if(IsPlayerConnected(para1))
    {
        if(para1 != INVALID_PLAYER_ID)
        {
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
format(string, sizeof(string), "   You have been promoted to a level %d admin by %s", level, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
}
}
return 1;
}
    if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/a)dmin [admin chat]");
return 1;
}
format(string, sizeof(string), "*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendAdminMessage(COLOR_YELLOW, string);
}
printf("Admin %s: %s", sendername, result);
}
}
return 1;
}

public SendAdminMessage(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
    if(PlayerInfo[i][pAdmin] >= 1)
    {
SendClientMessage(i, color, string);
}
}
}
}

public ABroadCast(color,const string[],level)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (PlayerInfo[i][pAdmin] >= level)
{
SendClientMessage(i, color, string);
printf("%s", string);
}
}
}
return 1;
}

strtok(const string[], &index) {
   new length = strlen(string),
   offset = index,
   result[20];
   while ((index < length) && (string[index] <= ' ')) { index++; }
   while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) {
   result[index - offset] = string[index];
   index++; } result[index - offset] = EOS;
   return result; }
Poslednja Izmena: Januar 20, 2011, 20:41:26 POSLE PODNE od xzeL