23.08.2009, 22:46
Quote:
Originally Posted by JaTochNietDan
It's very simple, just add the #define dcmd code which you can find on the forums, and also the sscanf function, trust me, its alot better than using strtok.
|
Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Код:
C:\Documents and Settings\Administrador\Mis documentos\Samp Server\gamemodes\nfs.pwn(459) : error 017: undefined symbol "dcmd_login" C:\Documents and Settings\Administrador\Mis documentos\Samp Server\gamemodes\nfs.pwn(462) : error 017: undefined symbol "sscanf" C:\Documents and Settings\Administrador\Mis documentos\Samp Server\gamemodes\nfs.pwn(474) : warning 204: symbol is assigned a value that is never used: "logueado"
pawn Код:
dcmd_login(playerid,params[])
{
new password[20];
if(sscanf(params,"s",password)) SendClientMessage(playerid,COLOR_GREY,"Utiliza: /login <password>");
else
{
new query[128];
new name[24];
GetPlayerName(playerid,name,sizeof(name));
samp_mysql_real_escape_string(password,password);
format(query,sizeof(query),"SELECT id FROM `players` WHERE Nombre = '%s' AND Password = '%s'",name,password);
samp_mysql_query(query);
samp_mysql_store_result();
if(samp_mysql_num_rows() > 0)
{
logueado = 1;
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________________");
SendClientMessage(playerid, COLOR_YELLOW, "Has sido logueado correctamente.");
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________________");
}
else
{
if(intentos == 3)
{
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________________");
SendClientMessage(playerid, COLOR_YELLOW, "Limites de intentos por contraseсa. Has sido Kickeado.");
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________________");
Kick(playerid);
}
else
{
intentos = intentos +1;
SendClientMessage(playerid, COLOR_GREEN, "_________________________________________");
SendClientMessage(playerid, COLOR_YELLOW, "Contraseсa incorrecta.");
SendClientMessage(playerid, COLOR_GREEN, "_________________________________________");
}
}
}
}