Balkan SA:MP

PAWN skriptanje, gamemodovi, filterskripte, include fajlovi, mape, pluginovi => Razgovor u vezi PAWN - skriptanja => Temu započeo: [IF] mariomako poslato Jul 26, 2010, 13:39:42 POSLE PODNE

Naslov: Koristite /changepass [novi apssword]
Poruka od: [IF] mariomako poslato Jul 26, 2010, 13:39:42 POSLE PODNE
CMD:changepassword(playerid, params[])
{
    if(!UserExists(playerid)) return SendClientMessage(playerid, COLOR_RED,"To ime nije registrirano napisi /register [lozinka].");
    if(!params[0]) return SendClientMessage(playerid, COLOR_RED, "Tocnije: /changepassword [nova lozinka]");
    if(PlayerInfo[playerid][LoggedIn] == 0) return SendClientMessage(playerid, COLOR_RED,"Nisi ulogiran!");

    new FilePath[128];
format(FilePath, sizeof(FilePath), "Korisnici/%s.ini", PlayerName(playerid));

    new password = num_hash(params);
    PlayerInfo[playerid][Password] = password;

dini_IntSet(FilePath,"Password",PlayerInfo[playerid][Password]);
if (IgracInfo[playerid][Jezik] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Èíôîðìàöè¼à:");
new string[256]; format(string, sizeof(string), "Ã"ñïåøíî ¼à ïðîìåíèâòå âàøàòà ëîçèíêà, íîâàòà ëîçèíêà Ã¥: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
if (IgracInfo[playerid][Jezik] == 2)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Informacije:");
new string[256]; format(string, sizeof(string), "Uspesno ste promenili password, novi password je: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
if (IgracInfo[playerid][Jezik] == 3)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Information:");
new string[256]; format(string, sizeof(string), "Successful change your password, your new password is: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}


Ovo je moja komanda za mjenjanje password ali kad upisem samo /changepassword pobrisemi password a kad upisem /changepassword [neki password] tada radi sve normalno a sad me zanima kako da napravim kad upisem smo /changepassword da mi izage da sam krivo koristio komandu kako sto ima na neki servere korsitite /ban [id] [razlog]
Naslov: Odg: Koristite /changepass [novi apssword]
Poruka od: LordShigi poslato Jul 26, 2010, 14:34:26 POSLE PODNE
S obzirom da koristis ZCMD, stavi if (isnull(params))
Naslov: Odg: Koristite /changepass [novi apssword]
Poruka od: [IF] mariomako poslato Jul 26, 2010, 15:05:24 POSLE PODNE
Citat: LordShigi poslato Jul 26, 2010, 14:34:26 POSLE PODNE
S obzirom da koristis ZCMD, stavi if (isnull(params))

gde to da stavim?
Naslov: Odg: Koristite /changepass [novi apssword]
Poruka od: LordShigi poslato Jul 26, 2010, 15:12:07 POSLE PODNE
Evo ti gotova komanda:
CMD:changepassword(playerid, params[])
{
    if(!UserExists(playerid)) return SendClientMessage(playerid, COLOR_RED,"To ime nije registrirano napisi /register [lozinka].");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Tocnije: /changepassword [nova lozinka]");
    if(PlayerInfo[playerid][LoggedIn] == 0) return SendClientMessage(playerid, COLOR_RED,"Nisi ulogiran!");

    new FilePath[128];
format(FilePath, sizeof(FilePath), "Korisnici/%s.ini", PlayerName(playerid));

    new password = num_hash(params);
    PlayerInfo[playerid][Password] = password;

dini_IntSet(FilePath,"Password",PlayerInfo[playerid][Password]);
if (IgracInfo[playerid][Jezik] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Èíôîðìàöè¼à:");
new string[256]; format(string, sizeof(string), "Ã"ñïåøíî ¼à ïðîìåíèâòå âàøàòà ëîçèíêà, íîâàòà ëîçèíêà Ã¥: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
if (IgracInfo[playerid][Jezik] == 2)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Informacije:");
new string[256]; format(string, sizeof(string), "Uspesno ste promenili password, novi password je: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
if (IgracInfo[playerid][Jezik] == 3)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Information:");
new string[256]; format(string, sizeof(string), "Successful change your password, your new password is: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
Naslov: Odg: Koristite /changepass [novi apssword]
Poruka od: Joey_ poslato Jul 26, 2010, 15:13:19 POSLE PODNE
Ili samo makni ovaj ! ispred params[0]
Naslov: Odg: Koristite /changepass [novi apssword]
Poruka od: [IF] mariomako poslato Jul 26, 2010, 15:53:18 POSLE PODNE
problem resen

a sada sam malo editao komandu pa zasto mi nalazi ove errore

E:\SAMP Server\PitBull Freeroam\gamemodes\pitbull.pwn(774) : error 029: invalid expression, assumed zero

CMD:changepassword(playerid, params[])
{
    if(!UserExists(playerid))
else
{
if (IgracInfo[playerid][Jezik] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "/changepassword [nova lozinka]");
}
if (IgracInfo[playerid][Jezik] == 2)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "/changepassword [novi password]");
}
if (IgracInfo[playerid][Jezik] == 3)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "/changepassword [new password]");
}
}
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Tocnije: /changepassword [nova lozinka]");
    if(PlayerInfo[playerid][LoggedIn] == 0) return SendClientMessage(playerid, COLOR_RED,"Nisi ulogiran!");

    new FilePath[128];
format(FilePath, sizeof(FilePath), "Korisnici/%s.ini", PlayerName(playerid));

    new password = num_hash(params);
    PlayerInfo[playerid][Password] = password;

dini_IntSet(FilePath,"Password",PlayerInfo[playerid][Password]);
if (IgracInfo[playerid][Jezik] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Èíôîðìàöè¼à:");
new string[256]; format(string, sizeof(string), "Ã"ñïåøíî ¼à ïðîìåíèâòå âàøàòà ëîçèíêà, íîâàòà ëîçèíêà Ã¥: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
if (IgracInfo[playerid][Jezik] == 2)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Informacije:");
new string[256]; format(string, sizeof(string), "Uspesno ste promenili password, novi password je: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
if (IgracInfo[playerid][Jezik] == 3)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Information:");
new string[256]; format(string, sizeof(string), "Successful change your password, your new password is: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
Naslov: Odg: Koristite /changepass [novi apssword]
Poruka od: LordShigi poslato Jul 26, 2010, 16:04:23 POSLE PODNE
A da nam das mozda liniju?

I zasto pobogu koristis veličinu stringa 256 kad samp ne dopušta da ispišeš string veći od 128(i to je previse jer ni tolko slova nemas).
Naslov: Odg: Koristite /changepass [novi apssword]
Poruka od: [IF] mariomako poslato Jul 26, 2010, 16:30:50 POSLE PODNE
evo sada cela komanda ne nalazi errore

ali kad idem /changepass od svi poruke mi izage po jedna i plus mi obrise password

CMD:changepassword(playerid, params[])
{
if(UserExists(playerid)) {
if(IgracInfo[playerid][Jezik] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Îâàà êîðèñíè÷êî èìå íå å ðåãèñòèðàíî.");
}
if (IgracInfo[playerid][Jezik] == 2)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Ovo korisnicko ime nije registirano.");
}
if (IgracInfo[playerid][Jezik] == 3)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "This username is not registred.");
}
}
if(isnull(params)) {
if(IgracInfo[playerid][Jezik] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "/changepassword [íîâà ëîçèíêà]");
}
if (IgracInfo[playerid][Jezik] == 2)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "/changepassword [novi password]");
}
if (IgracInfo[playerid][Jezik] == 3)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "/changepassword [new password]");
}
}
    if(PlayerInfo[playerid][LoggedIn] == 0) return SendClientMessage(playerid, COLOR_RED,"Nisi ulogiran!");

    new FilePath[128];
format(FilePath, sizeof(FilePath), "Korisnici/%s.ini", PlayerName(playerid));

    new password = num_hash(params);
    PlayerInfo[playerid][Password] = password;

dini_IntSet(FilePath,"Password",PlayerInfo[playerid][Password]);
if (IgracInfo[playerid][Jezik] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Èíôîðìàöè¼à:");
new string[256]; format(string, sizeof(string), "Ã"ñïåøíî ¼à ïðîìåíèâòå âàøàòà ëîçèíêà, íîâàòà ëîçèíêà Ã¥: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
if (IgracInfo[playerid][Jezik] == 2)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Informacije:");
new string[256]; format(string, sizeof(string), "Uspesno ste promenili password, novi password je: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
if (IgracInfo[playerid][Jezik] == 3)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Information:");
new string[256]; format(string, sizeof(string), "Successful change your password, your new password is: \'%s\'.", params);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}