1
Script Discussion / [Suggestion|Question]Play a sound
« on: September 14, 2014, 09:16:54 pm »
how to play a audio file? and if you cant, I suggest you add it.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
new IsHealing[100];
new HealCount[100];
Some definitions#define HEAL_HEALTH_AMOUNT 100 //the amount of heal you wanna give after healing
#define HEAL_TIME_SECONDS 10 //the time you want to take to heal in seconds
And a timer, ofcoursepublic OnGameModeInit()
{
NewTimer("Healed", 1000, 1);
}
And the timed functionpublic Healed()
{
for(new i; i<=100; i++)
{
if(IsHealing[i]==1)
{
HealCount[i]++;
if(HealCount[i]== HEAL_TIME_SECONDS)
{
IsHealing[i] = 0;
SetPlayerHealth(i, HEAL_HEALTH_AMOUNT);
}
}
}
}
and where you want to make the heal (example !heal)IsHealing[playerid] = 1;
HealCount[playerid] = 0;
stock nedbset(entry[], point1[], point2[], data[])//entry: The entry you want to edit, data: The variable you want to edit in entry, point: The string you want to set the variable to.
stock nedbget(entry[], point1[], point2[])//Gets a variable info
:::nedbint:::same as nedbget but return integer
:::nedbfloat:::same as nedbget but return float
Script[gamemodes/SFB.amx]: Run time error 20: "Invalid index parameter (bad entry point)"
Here is the code (to download):int OnPlayerText args playerid, text start
if(strcmd(text, "hello", true) == 0)
{
MessageSendPlayer(playerid, (color), "Hello!");
Test();
}
int Test arg start
MessageSendAll("Droopy proopy, hello fellow");
end
int PrintNumbers arg amount start
new_variable count;
while(count < amount)
{
printf("%d", count);
count add 1;
end
SkinNew, VehicleNew and PickupNew don't have examples public OnPlayerText(playerid, cmdtext[])
{
if(strfind(cmdtext, "!", true) == 0) OnPlayerCommand(playerid, cmdtext[1]);//this is to prevent confusion between different scripts.
}
Add public OnPlayerCommand:public OnPlayerCommand(playerid, command[])
{
new idx, cmd[243];
new tmp[243], tmp2[243];//we put array to be able to use strcmp on it
cmd = strtok(command, idx);
tmp = strtok(command, idx);//we use this here so we dont always need to define tmp
tmp2 = strtok(command, idx);
if(strcmp(command, "autofix", true) == 0){
if(autofix[playerid] == 0)
{
autofix[playerid] = 1;
SendClientMessage(playerid, 0x0FFDD349, "Autofix set to: [ON]");
}
if(autofix[playerid] == 1)
{
autofix[playerid] = 0;
SendClientMessage(playerid, 0x0FFDD349, "Autofix set to: [OFF]");
}
}
}
Add public autofixtimer