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]
S obzirom da koristis ZCMD, stavi if (isnull(params))
Citat: LordShigi poslato Jul 26, 2010, 14:34:26 POSLE PODNE
S obzirom da koristis ZCMD, stavi if (isnull(params))
gde to da stavim?
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);
}
Ili samo makni ovaj ! ispred params[0]
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);
}
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).
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);
}