2 problemas con valores.
#1

Buenas, les mostrarй dos problemas que tengo.

1. Valores de HP.
Hice un sistema de daсos con arma, y puse para que para determinada arma le baje un 5 por ciento de vida, pero testeandolo me encuentro que de un solo tiro le baja 100 y se muere el PJ. Cуmo puse el valor:

PHP код:
SetPlayerHealth(playerid, -5.0); 
2. Valores de Dini se duplican.

Cree este comando:

PHP код:
CMD:certificar(playeridparams[]){
    if(
PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playeridCOLOR_GRAD2"ЎNo autorizado!");
    if(!
sscanf(params"s[32]"params[0])){
        if(
strfind(params[0], "_" true) != -1){
            new 
string3[64], string[128];
            
format(string3,sizeof(string3),"Usuarios/%s.lvrp",params[0]);
            if(
dini_Exists(string3)){
                new 
INI:ini INI_Open(string3);
                
INI_WriteInt(ini"Certificado"1);
                
INI_Close(ini);
                
format(stringsizeof(string), "AdmLVRP: %s certificу la cuenta a nombre: %s",RPN(playerid), params[0]);
                
SendAdminMessage(COLOR_YELLOW1string);
            } else 
SendClientMessage(playeridCOLOR_GRAD2"No se encontrу una cuenta con ese nombre");
        } else 
SendClientMessage(playeridCOLOR_GRAD2"Usб: /certificar <Nombre_Jugador>");
    } else 
SendClientMessage(playeridCOLOR_GRAD2"Usб: /certificar <Nombre_Jugador>");
    return 
1;

Pero resulta que en usuarios.ini sale asн:

Код:
Certificado = 1
[data]
Password = 67109274
Dinero = 5000
Admin = 5
Kills = 0
Job = 0
Negocio = 0
Faccion = 0
Lider = 0
Edad = 0
LlegandoAlServidor = 0
Carnet = 0
Muertes = 0
Certificado = 0
El dato que en realidad sirve es el ъltimo (Certificado = 0) pero el comando me crea uno nuevo, que no sirve. їCуmo hago para que no cree un dato nuevo y que SН edite el que vale?
Reply
#2

Irнa asн
pawn Код:
new Float:Health;
GetPlayerHealth(playerid, Health);
SetPlayerHealth(playerid, Health-5);
Con lo que vos pusiste al jugador se le setea -5 de vida y muere directamente.
Reply
#3

Quote:
Originally Posted by JustBored
Посмотреть сообщение
Irнa asн
pawn Код:
new Float:Health;
GetPlayerHealth(playerid, Health);
SetPlayerHealth(playerid, Health-5);
Con lo que vos pusiste al jugador se le setea -5 de vida y muere directamente.
Gracias! Ahora necesito alguien que me pueda ayudar con el segundo
Reply
#4

Revivo, necesito ayuda con el segundo problema
Reply
#5

No estoy seguro nunca he usado y_ini pero creo que debes usar INI_SetTag(ini, "data"); antes de escribir en el archivo.
Reply
#6

PHP код:
CMD:certificar(playeridparams[]){
    if(
PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playeridCOLOR_GRAD2"ЎNo autorizado!");
    if(!
sscanf(params"s[32]"params[0])){
        if(
strfind(params[0], "_" true) != -1){
            new 
string3[64], string[128];
            
format(string3,sizeof(string3),"Usuarios/%s.lvrp",params[0]);
            if(
dini_Exists(string3)){
                new 
INI:ini INI_Open(string3);
                
INI_SetTag(ini,"Datos");//// aqui va el nombre que le asignastes al tag del sistema de registro.
                
INI_WriteInt(ini"Certificado"1);
                
INI_Close(ini);
                
format(stringsizeof(string), "AdmLVRP: %s certificу la cuenta a nombre: %s",RPN(playerid), params[0]);
                
SendAdminMessage(COLOR_YELLOW1string);
            } else 
SendClientMessage(playeridCOLOR_GRAD2"No se encontrу una cuenta con ese nombre");
        } else 
SendClientMessage(playeridCOLOR_GRAD2"Usб: /certificar <Nombre_Jugador>");
    } else 
SendClientMessage(playeridCOLOR_GRAD2"Usб: /certificar <Nombre_Jugador>");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)