GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: scott1 le 02 Juillet 2010, 21:29:28

Titre: Cherche une fonction
Posté par: scott1 le 02 Juillet 2010, 21:29:28
Bonjour a toutes et a tous,

je cherche une fonction mais comme wiki samp est down je ne peux pas rechercher,

Je cherche la fonction quand un joueur prend une boisson a une machine. Merci d'avance
Titre: Re : Cherche une fonction
Posté par: Myk3L le 02 Juillet 2010, 22:15:27
Cherche sur Google, tu clique sur "En cache" et le tour est joué :D
Titre: Re : Cherche une fonction
Posté par: scott1 le 03 Juillet 2010, 18:36:13
Ok merci
Titre: Re : Cherche une fonction
Posté par: chneubeul le 03 Juillet 2010, 18:39:40
http://solidfiles.com/d/287b/ (http://solidfiles.com/d/287b/)

Cadeau :)

C'est l'include SeifMachine

Qui s'utilise comme ceci dans ton OnGameModeInit

Machine à boisson '' Sprunk ''
AddSprunkMachine(X, Y, Z,RX,RY,RZ);

Machine grise avec les gateaux etc..
AddCandyMachine(X, Y, Z,RX,RY,RZ);

puis :

dans OnPlayerKeyStateChange:


if (newkeys & 16 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
    for(new M = 1; M < MAX_MACHINES; M++)
    {
    new Float:A,Float:H;
    GetPlayerFacingAngle(playerid,A);
    FoodMachines[M][fmX] -= (1 * floatsin(-A, degrees));
FoodMachines[M][fmY] -= (1 * floatcos(-A, degrees));
if (Seif_PlayerToPoint(playerid,1,FoodMachines[M][fmX],FoodMachines[M][fmY],FoodMachines[M][fmZ]) && GetPlayerMoney(playerid) >= MACHINE_CASH)
{
    if (FoodMachines[M][fmType] == 1)
    {
    GetPlayerHealth(playerid,H);
    ApplyAnimation(playerid,"VENDING","VEND_Use",4.1,0,1,1,1,1);
GivePlayerMoney(playerid,-MACHINE_CASH);
PlayerPlaySound(playerid,42600,0.0,0.0,0.0);
Anim[playerid] = 1;
SetTimerEx("MachineAnimation",2000,0,"d",playerid);
    if (H <= 75) SetPlayerHealth(playerid,H+25);
    else SetPlayerHealth(playerid,100);
}
else if (FoodMachines[M][fmType] == 2)
{
    GetPlayerHealth(playerid,H);
    ApplyAnimation(playerid,"VENDING","VEND_Use",4.1,0,1,1,1,1);
GivePlayerMoney(playerid,-MACHINE_CASH);
PlayerPlaySound(playerid,42601,0.0,0.0,0.0);
Anim[playerid] = 2;
SetTimerEx("MachineAnimation",2000,0,"d",playerid);
    if (H <= 75) SetPlayerHealth(playerid,H+25);
    else SetPlayerHealth(playerid,100);
}
}
FoodMachines[M][fmX] += (1 * floatsin(-A, degrees));
FoodMachines[M][fmY] += (1 * floatcos(-A, degrees));
}
}