19.08.2011, 23:07
Hey,
I have already posted a 'help' thread thats done.
But it dont work now.
i hope somebody can find the 'mistake' (I hope.)
its a include, and you need to set AutomatichSprunk in Onkeystatechange.
Code:
(No errors)
Thanks,
Wouter0100
I have already posted a 'help' thread thats done.
But it dont work now.
i hope somebody can find the 'mistake' (I hope.)
its a include, and you need to set AutomatichSprunk in Onkeystatechange.
Code:
pawn Код:
#include <a_samp>
#if (!defined MAX_SPRUNK)
#error Please define MAX_SPRUNK before including the AutomatichSprunk include.
#endif
#if (!defined SPRUNK_PAY)
#error Please define SPRUNK_PAY before including the AutomatichSprunk include.
#endif
#if (!defined SPRUNK_TEXT)
#error Please define SPRUNK_TEXT before including the AutomatichSprunk include.
#endif
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define COLOR_GREY 0xAFAFAFAA
new Sprunk = 0,
Float: X[MAX_SPRUNK],
Float: Y[MAX_SPRUNK],
Float: Z[MAX_SPRUNK],
TookSprunk[MAX_PLAYERS];
stock n_CreateObject(modelid, Float: oX, Float: oY, Float: oZ, Float: orX, Float: orY, Float: orZ, Float: DrawDistance)
{
new id;
id = CreateObject(modelid, oX, oY, oZ, orX, orY, orZ, DrawDistance);
if(modelid == 1546)
{
Sprunk++;
X[Sprunk] = oX;
Y[Sprunk] = oY;
Z[Sprunk] = oZ;
}
return id;
}
stock AutomatichSprunk(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SECONDARY_ATTACK))
{
if(IsAtCandySprunk(playerid))
{
if(TookSprunk[playerid] == 0)
{
new Float:health;
GetPlayerHealth(playerid, health);
if(health != 0)
{
GivePlayerMoney(playerid, ( GetPlayerMoney(playerid) - SPRUNK_PAY ) );
new string[60];
format(string, sizeof(string), SPRUNK_TEXT, SPRUNK_PAY);
SendClientMessage(playerid, COLOR_GREY, string);
TookSprunk[playerid] = 1;
SetTimerEx("Heal",3750,false, "i", playerid);
}
}
}
}
return 1;
}
stock Heal(playerid)
{
new Float:Health;
GetPlayerHealth(playerid, Health);
SetPlayerHealth(playerid, (Health + 15));
TookSprunk[playerid] = 0;
}
stock IsAtCandySprunk(playerid)
{
for(new i=0; i < Sprunk; i++){
if(IsPlayerInRangeOfPoint(playerid, 2, X[i], Y[i], Z[i])) return 1;
}
return 0;
}
#define CreateObject n_CreateObject
Thanks,
Wouter0100