SA-MP Forums Archive
[Ayuda] GetPlayerKeys ... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: [Ayuda] GetPlayerKeys ... (/showthread.php?tid=383844)



[Ayuda] GetPlayerKeys ... - OTACON - 09.10.2012

Buenas a Todos, Quiera ke me ayuden con esta duda e problemita ke tengo :S.

1- hice un menu con GetPlayerKeys con un SetTimerEx en 100 y las variables las cree globlares y con array para el player y staticas para ke no se esten creando cada vez ke hace la funcion GetPlayerKeys pero es muy Rapido con 100 y si le subo a 150 es muy lento como podria solucionar esto?.

Desde ya muchas Gracias .


Re: [Ayuda] GetPlayerKeys ... - Glimma - 09.10.2012

їNo puedes usar new en lugar de static?


Respuesta: Re: [Ayuda] GetPlayerKeys ... - OTACON - 09.10.2012

Quote:
Originally Posted by DeadSkyTkb
Посмотреть сообщение
їNo puedes usar new en lugar de static?
xD , me acabo de dar cuenta ke esta haciendo lo mismo por ke son globales xD, creo

igual diganmen si estoy haciendo bien todo el prodedimiento, ya cambiando el a new.

EDIT: estan bien en static Segun wiki

Quote:

Globales Las variables estбticas son variables globales como normales, pero sуlo se puede utilizar en el archivo en el que se declaran:

https://sampwiki.blast.hk/wiki/Scripting...#global_static


Respuesta: Re: [Ayuda] GetPlayerKeys ... - Fluid016 - 09.10.2012

Quote:
Originally Posted by bytytus
Посмотреть сообщение
xD , me acabo de dar cuenta ke esta haciendo lo mismo por ke son globales xD, creo

igual diganmen si estoy haciendo bien todo el prodedimiento, ya cambiando el a new.

EDIT: estan bien en static Segun wiki



https://sampwiki.blast.hk/wiki/Scripting...#global_static
Si te parece muy rapido con 100 y muy lento con 150 dale 130, 125, 120 (yo que se xD)


Respuesta: Re: [Ayuda] GetPlayerKeys ... - OTACON - 09.10.2012

Quote:
Originally Posted by GROVE22
Посмотреть сообщение
Si te parece muy rapido con 100 y muy lento con 150 dale 130, 125, 120 (yo que se xD)
¬¬ Yal o intente, y pasa lo mismo XD


Respuesta: Re: [Ayuda] GetPlayerKeys ... - Fluid016 - 09.10.2012

Quote:
Originally Posted by bytytus
Посмотреть сообщение
¬¬ Yal o intente, y pasa lo mismo XD
El tiempo lo tienes en milesegundos nunca NO te podrб servir ningъn tiempo -.-
osea algъn tiempo te tiene que ir bien.

Y no se lo que tratas de hacer si me dices por ahн me venga alguna idea


Respuesta: [Ayuda] GetPlayerKeys ... - Jovanny - 09.10.2012

pawn Код:
new bool:DetectarKeys[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
    if(DetectarKeys[playerid])
    {
        new Keys, ud, lr;
        GetPlayerKeys(playerid, Keys, ud, lr);
        if(ud > 0) printf("Arriba");
        else if(ud < 0) printf("Abajo");
        if(lr > 0) printf("Derecha");
        else if(lr < 0) printf("Izquierda");
    }
    return 1;
}
Cuando quieras que se detecten las teclas setea el booleano del playerid en verdadero
pawn Код:
DetectarKeys[playerid] = true;



Respuesta: [Ayuda] GetPlayerKeys ... - OTACON - 09.10.2012

Quote:
Originally Posted by Jovanny
Посмотреть сообщение
[/pawn]
new booletectarKeys[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
if(DetectarKeys[playerid])
{
new Keys, ud, lr;
GetPlayerKeys(playerid, Keys, ud, lr);
if(ud > 0) printf("Arriba");
else if(ud < 0) printf("Abajo");
if(lr > 0) printf("Derecha");
else if(lr < 0) printf("Izquierda");
}
}
[/pawn]

Cuando quieras que se detecten las teclas setea el booleano del playerid en verdadero
pawn Код:
DetectarKeys[playerid] = true;
pero no es muchos OnPlayerUpdate para GetPlayerKeys, OnPlayerUpdate?
actualiza muy rapido muchas veces :S.


Respuesta: [Ayuda] GetPlayerKeys ... - Fluid016 - 09.10.2012

Quote:
Originally Posted by bytytus
Посмотреть сообщение
pero no es muchos OnPlayerUpdate para GetPlayerKeys, OnPlayerUpdate?
actualiza muy rapido muchas veces :S.
Esta bien es un menu en textdraws

Pero que pasa cuando actualiza muy rapido? Osea tu problema xD


Respuesta: [Ayuda] GetPlayerKeys ... - OTACON - 09.10.2012

Quote:
Originally Posted by GROVE22
Посмотреть сообщение
Esta bien es un menu en textdraws

Pero que pasa cuando actualiza muy rapido? Osea tu problema xD
y yo lo tengo con un SetTimerEx , imaginate si lo coloco en OnPlayerUpdate :S XD