[Ajuda] Salvar Vida
#1

Olб, estou tentando salvar a vida do player mais porem ele fica 0 no banco de dados, alguem me ajuda?

PHP код:

mysql_format
(DB_CONEXAOgstringsizeof gstring"UPDATE `player_info` SET `Vida` = %f WHERE `id` = %d",
GetPlayerHealth(playerids_vida),
PlayerInfo[playerid][playerID]); 
Reply
#2

PHP код:
new Floatvida;
GetPlayerHealth(playeridvida);

mysql_format(DB_CONEXAOgstringsizeof(gstring), "UPDATE `player_info` SET `Vida` = '%0.3f' WHERE `id` = %d"
vida
PlayerInfo[playerid][playerID]); 
Reply
#3

Quote:
Originally Posted by DelK
Посмотреть сообщение
PHP код:
new Floatvida;
GetPlayerHealth(playeridvida);
mysql_format(DB_CONEXAOgstringsizeof(gstring), "UPDATE `player_info` SET `Vida` = '%0.3f' WHERE `id` = %d"
vida
PlayerInfo[playerid][playerID]); 
Intгo continuar mesma coisa, sera que й valor do salvamento da tabela, tipo varchar, int ? estou com o mesmo problema na hora de salvar a posiзгo do player exemplo: 1107.5328 no banco de dados ele salva somente o 1107 sem o ( . ) ponto.
Reply
#4

coloque como float quando for criar a tabela use o float

PHP код:
CREATE TABLE IF NOT EXISTS `Contas` (`Vidafloat NOT NULL, `Xfloat NOT NULL, `Yfloat NOT NULL, `Zfloat NOT NULL, `Afloat NOT NULL// se quiser colocar default '-' eu nгo utilizei pq acho que n vai ficar legal. :z default na vida 100.0 seria bom! :) sei lб. 
Mesma coisa com as Posiзхes na hora de dar update use '%f' ou '%0.3f'

PHP код:
new Float:VidaFloat:Pos[4];
GetPlayerHealth(playeridVida);
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
GetPlayerFacingAngle(playeridPos[3]);
mysql_format(DB_CONEXAOgstringsizeof(gstring), "UPDATE `Contas` SET `Vida` = %f, `X` = %f, `Y` = %f, `Z` = %f `A` = %f WHERE `ID` = %d"VidaPos[0], Pos[1], Pos[2], Pos[3], PlayerInfo[playerid][pID]); 
Reply
#5

Quote:
Originally Posted by SIZET
Посмотреть сообщение
coloque como float quando for criar a tabela use o float

PHP код:
CREATE TABLE IF NOT EXISTS `Contas` (`Vidafloat NOT NULL DEFAULT 100.0
Mesma coisa com as Posiзхes na hora de dar update use '%f' ou '%0.3f'

PHP код:
new Float:VidaFloat:Pos[4];
GetPlayerHealth(playeridVida);
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
GetPlayerFacingAngle(playeridPos[3]);
mysql_format(DB_CONEXAOgstringsizeof(gstring), "UPDATE `Contas` SET `Vida` = %f, `X` = %f, `Y` = %f, `Z` = %f `A` = %f WHERE `ID` = %d"VidaPos[0], Pos[1], Pos[2], Pos[3], PlayerInfo[playerid][pID]); 
Opб deu certo aqui viw +rep!
Reply
#6

Vlw! Eu to iniciando com mysql tbm mas jб entendo o que estб acontecendo й nгo sei se ta certo colocar o update sem o ( antes do SET

EX:

PHP код:
UPDATE `ContasSET // nгo sei se funfa.
UPDATE `ContasSET // funfa 
Sem o ( eu coloco й tbm n da erro vendo as video aula do Curso em Vнdeo ta me ajudando bastante! Se nгo viu ainda trata-se de ver
Reply
#7

Quote:
Originally Posted by SIZET
Посмотреть сообщение
Vlw! Eu to iniciando com mysql tbm mas jб entendo o que estб acontecendo й nгo sei se ta certo colocar o update sem o ( antes do SET

EX:

PHP код:
UPDATE `ContasSET // nгo sei se funfa.
UPDATE `ContasSET // funfa 
Sem o ( eu coloco й tbm n da erro vendo as video aula do Curso em Vнdeo ta me ajudando bastante! Se nгo viu ainda trata-se de ver
Sem o parenteses funciona da mesma forma, pois o que vai importar mesmo й o `Contas` que representa a coluna alvo. Bom pelo menos pra min funciona
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)