GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: 69scorpion le 26 Août 2009, 19:29:08

Titre: commande a touche
Posté par: 69scorpion le 26 Août 2009, 19:29:08
Bonsoir,

Je voudrais savoir si vous savez comment utiliser une commande avec les touches du clavier j'ai télécharger un FS(Entrer dans le shamal en tant que passager)  pour essayer de trouver le  seul le callback que j'ai trouver de suspect dans le FS c'est sa :

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & 16 && InShamal[playerid])
{
new Float:X, Float:Y, Float:Z, Float:A;
GetVehiclePos(InShamal[playerid], X, Y, Z);
GetVehicleZAngle(InShamal[playerid], A);
X += (5 * floatsin(-floatsub(A, 45.0), degrees)),
Y += (5 * floatcos(-floatsub(A, 45.0), degrees));
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, X, Y, floatsub(Z, 0.94));
SetPlayerFacingAngle(playerid, A);
SetCameraBehindPlayer(playerid);
InShamal[playerid] = 0;
}
return 1;
}


Si vous pouvez m'aider sa sera vraiment sympa Merci d'avance


PS : touche G = 16
Titre: Re : commande a touche
Posté par: ApocKalipsS le 27 Août 2009, 11:08:39
J'ai pas bien compris ce que tu veux faire avec ceci, par exemple tu veux que losrqu'on appuie sur la touche G, il y a la commande par exemple "/truc" qui s'execute ?
Si c'est ça, il y a le FS de Urban Ghetto, qui fait Save Position, tu peux t'en inspiré.
Lien : http://www.gtaonline.fr/forums/index.php/topic,1867.0.html (http://www.gtaonline.fr/forums/index.php/topic,1867.0.html)
Titre: Re : commande a touche
Posté par: Syg le 27 Août 2009, 14:48:38
En allant voir dans a_samp.inc, on trouve :
#define KEY_SECONDARY_ATTACK (16)
Donc la touche correspondant au code 16 est celle qui est associée à l'attaque secondaire ("Tir secondaire" dans l'écran de configuration des commandes en véhicules).

Sinon, j'ai expliqué comment se servir des variables qui contiennent les touches dans ce topic :
http://www.gtaonline.fr/forums/index.php/topic,8289.0.html (http://www.gtaonline.fr/forums/index.php/topic,8289.0.html)

++
Syg