Ayuda 2 CMD tiempo..
#1

Le puse limite de uso a estos 2 comandos y ahora cuando uno coloca el comando pasa media hora y todavнa no se puede usar, que hice mal?

Код:
	if (strcmp("/hp", cmdtext, true, 10) == 0){
	if (tiempoA[playerid] == 0){
	    SetPlayerHealth(playerid, 100);
	    GivePlayerMoney(playerid, -1000);
        SendClientMessage(playerid,Rojo,"Solo puedes usar este comando cada 2 Minutos");
	    format(string2,sizeof(string2),"{FF0000}%s {00EFFF}Restauro su {FFFFFF}(/hp){00EFFF} por {00FF09}dinero",PlayerName2(playerid));
	    SendClientMessageToAll(COLOR_RED,string2);
	    tiempoA[playerid] = 1;
	SetTimerEx("TiempoA", 20000 , false, "d", playerid);
	}
		return 1;
	}

	if (strcmp("/armadura", cmdtext, true, 10) == 0){
	if (tiempoB[playerid] == 0){
	    SetPlayerArmour(playerid,100);
	    GivePlayerMoney(playerid, -1000);
        SendClientMessage(playerid,Rojo,"Solo puedes usar este comando cada 2 Minutos");
	    format(string2,sizeof(string2),"{FF0000}%s {00EFFF}Restauro su {FFFFFF}(/armadura){00EFFF} por {00FF09}dinero",PlayerName2(playerid));
	    SendClientMessageToAll(COLOR_RED,string2);
	    tiempoB[playerid] = 1; //tiempo que se activa
	SetTimerEx("TiempoB", 20000 , false, "d", playerid);
	    }
	    return 1;
	}
Reply
#2

Mostra el public de TiempoA y TiempoB
Reply
#3

Quote:
Originally Posted by Juance
Посмотреть сообщение
Mostra el public de TiempoA y TiempoB
Solo hay

Код:
forward TiempoA(playerid);
    new tiempoA[MAX_PLAYERS];
y asн con TiempoB
Reply
#4

pawn Код:
forward TiempoA(playerid);
public TiempoA(playerid)
{
    tiempoA[playerid] = 0;
    return 1;
}

forward TiempoB(playerid);
public TiempoB(playerid)
{
    tiempoB[playerid] = 0;
    return 1;
}
Pero sugiero que uses unix timestamps, los timers pueden crear lag.
Reply
#5

Hombre el el tema anterior te deje el cуdigo ya hecho donde no usas arrays la forma que te deje es la mas sencilla y segura.

http://forum.sa-mp.com/showpost.php?...37&postcount=9

Al menos probalo.

Usar un timer para esto no es para nada recomendable.
Reply
#6

Quote:
Originally Posted by Daniel-92
Посмотреть сообщение
Hombre el el tema anterior te deje el cуdigo ya hecho donde no usas arrays la forma que te deje es la mas sencilla y segura.

http://forum.sa-mp.com/showpost.php?...37&postcount=9

Al menos probalo.

Usar un timer para esto no es para nada recomendable.
Me tira errores;

error 001: expected token: ")", but found "return"
error 001: expected token: ")", but found "return"
Reply
#7

Revisa esto: https://sampforum.blast.hk/showthread.php?tid=439112
Reply
#8

Me faltaron unos parentesis ya deberia funcionar.
Reply
#9

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
pawn Код:
forward TiempoA(playerid);
public TiempoA(playerid)
{
    tiempoA[playerid] = 0;
    return 1;
}

forward TiempoB(playerid);
public TiempoB(playerid)
{
    tiempoB[playerid] = 0;
    return 1;
}
Pero sugiero que uses unix timestamps, los timers pueden crear lag.
Me tira los siguientes errores;

error 017: undefined symbol "tiempoA"
warning 215: expression has no effect
expected token: ";", but found "]"
invalid expression, assumed zero
fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Reply
#10

--> revisa esto: [Include] Simple SetTimerCMD By OTACON
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)