26.08.2013, 00:47
(
Последний раз редактировалось shittt; 26.08.2013 в 02:54.
)
Bom galera eu fiz estй codigo mais nao ta salvando alguem sabe oq e ?
Esse Sala era Salva *
pawn Код:
#include <a_samp>
#include <a_mysql>
#pragma tabsize 4
#define SCM SendClientMessage
#define ASVEX AddStaticVehicleEx
#define SRC SendRconCommand
new connectt;
main()
{
print("---------Carregando----------");
}
public OnGameModeInit()
{
SetGameModeText("Basic");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
ASVEX(520,2028.6824,1340.5647,10.8203,268.5515,0,0,0);
connectt = mysql_connect("localhost", "root", "brasil world start", "");
if(!mysql_ping(connectt)) print("carregado mysql..."), SRC("exit");
return 1;
}
forward Qualfoi(playerid);
public Qualfoi(playerid)
{
new Str[128], nome[21];
GetPlayerName(playerid, nome, 21);
format(Str, 128, "SELECT * FROM `contas` WHERE `Nome`='%s'", nome);
mysql_function_query(connectt, Str, true, "OnPlayerConnect", "i", playerid);
return 1;
}
public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
{
printf("%i %s %s %s %i", errorid, error, callback, query, connectionHandle);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/grana", cmdtext, true, 10) == 0)
{
GivePlayerMoney(playerid, 50000000);
SCM(playerid, -1, "Vocк ganhou grana .");
return 1;
}
if (strcmp("/Box", cmdtext, true, 10) == 0)
{
SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
SCM(playerid, -1, "Vocк mudou seu estilo de luta !");
return 1;
}
return 0;
}
public OnPlayerConnect(playerid)
{
new Row, Field;
cache_get_data(Row, Field, connectt);
if(Row) ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "LOGIN", "Digite sua senha", "Logar", "Sair");
else ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Registre-se", "Digite sua senha", "Registrar", "Sair");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid) {
new Str[222], nome[21];
GetPlayerName(playerid, nome, 20);
format(Str, 222, "INSERT INTO `contas`(`Nome`, `Senha`, `Level`, `Admin`, `Respeito`, `Org`, `Membro`) VALUES ('%s', '%i', '%i', '%i', '%i', '%i', '%i')", nome, hash(inputtext), 10, 8, 150, 2, 1);
mysql_function_query(connectt, Str, false, #, #);
SCM(playerid, -1, "Registrado com sucesso!");
}
else {
new Str[222], nome[21];
GetPlayerName(playerid, nome, 20);
format(Str, 222, "SELECT * FROM `contas` WHERE `Nome`='%s' AND `Senha`'%i'", nome, hash(inputtext));
mysql_function_query(connectt, Str, true, "zabu", "i", playerid);
}
return 1;
}
forward zabu(playerid);
public zabu(playerid)
{
new Row, Field;
cache_get_data(Row, Field, connectt);
if(Row) SCM(playerid, -1, "Logado com sucesso!");
else ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "LOGIN", "Senha Incorreta", "Logar", "Sair");
return 1;
}
Esse Sala era Salva *