Ayuda crear comando para registrarse en el foro
#1

Como dice el titulo quiero saber como crear un cmd para registrarse en el foro ya tengo la variable y todo definido solo falta crear el cmd para registrarse miren esta es la variable

stock CrearCuenta(name,password)
{
new stringg[1000];
format(stringg, sizeof(stringg),"INSERT INTO `smf_members` (real_name, passwd, member_name) VALUES('%s', sha1('%s'), '%s')",name[],password[],name[]);
mysql_query(stringg, -1, -1, CMySQL);
return 1;
}

Se lo agradecerнa mucho a quien me dija como hacerlo
Reply
#2

pawn Код:
if(!strcmp(cmd, "/registrar", true))
{
    new rName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, rName, sizeof(rName));
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_DE_ERROR, "/registrar [contraseсa]");
    CrearCuenta(rName,tmp);
    return 1;
}
Reply
#3

Quote:
Originally Posted by iSanchez
Посмотреть сообщение
pawn Код:
if(!strcmp(cmd, "/registrar", true))
{
    new rName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, rName, sizeof(rName));
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_DE_ERROR, "/registrar [contraseсa]");
    CrearCuenta(rName,tmp);
    return 1;
}
logre reparar algunos errores ahora son estos:

C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(854 -- 861) : error 017: undefined symbol "cmd"
C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(866) : error 029: invalid expression, assumed zero
C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(866) : error 017: undefined symbol "idx"
C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(866) : warning 215: expression has no effect
C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(86 : error 035: argument type mismatch (argument 1)
C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(872) : error 030: compound statement not closed at the end of file (started at line 861)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128],idx;
    cmd = strtok(cmdtext, idx);

       ....
Reply
#5

Quote:
Originally Posted by iSanchez
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128],idx;
    cmd = strtok(cmdtext, idx);

       ....
ahora me dan estos...

C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(861) : error 017: undefined symbol "strtok"
C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(861) : error 033: array must be indexed (variable "cmd")
C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(867) : error 017: undefined symbol "strtok"
C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(867) : error 033: array must be indexed (variable "tmp")
C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(869) : error 035: argument type mismatch (argument 1)
C:\Users\maicol\Desktop\sv\Gamemode\gamemodes\Game mode.pwn(872) : error 030: compound statement not closed at the end of file (started at line 860)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Reply
#6

Maicolpao, te recomiendo utilizar zcmd y sscanf.
Reply
#7

Quote:
Originally Posted by _Zume
Посмотреть сообщение
Maicolpao, te recomiendo utilizar zcmd y sscanf.
y como seria el cmd en zcmd?
Reply
#8

Quote:
Originally Posted by maicolpao
Посмотреть сообщение
y como seria el cmd en zcmd?
pawn Код:
CMD:registrar(playerid,params[])
{
    new rName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, rName, sizeof(rName));
    if(sscanf(params, "d", params[0])) return SendClientMessage(playerid, red, "[USA]: /registrar [Contraseсa]");
    CrearCuenta(rName,params[0]);
    return 1;
}
algo asн seria xD
Reply
#9

Quote:
Originally Posted by !R1Ch@rD!
Посмотреть сообщение
pawn Код:
CMD:registrar(playerid,params[])
{
    new rName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, rName, sizeof(rName));
    if(sscanf(params, "d", params[0])) return SendClientMessage(playerid, red, "[USA]: /registrar [Contraseсa]");
    CrearCuenta(rName,params[0]);
    return 1;
}
algo asн seria xD
tu cmd me da un error (882) : error 035: argument type mismatch (argument 1) la linea es

CrearCuenta(rName,params[0]);

y este es el stock crearcuenta

stock CrearCuenta(name,password)
{
new stringg[1000];
format(stringg, sizeof(stringg),"INSERT INTO `smf_members` (real_name, passwd, member_name) VALUES('%s', sha1('%s'), '%s')",name,password,name);
mysql_query(stringg, -1, -1, CMySQL);
return 1;
Reply
#10

Nadie tiene idea de como crearlo? o aunque sea una variable de cuando conecte llame al stock
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)