Issue with sound repeating + Textdraw error on FS
#1

I am working on a radiation script that basically does three things

1 - Displays a Textdraw

2 - Has multiple locations

3 - plays a sound file


The Errors I am having are as follows


a - Textdraw comes up as a different textdraw from the gamemode (they have different labels, i labeled this one 8 one in GM is 0)

b - the sound file automatically hits play every second, therfor it spams the screen and doesnt play in full (its 9 seconds long) - i am guessing i need some kind of pause?



// Radiation Area With Textdraw Created By AndrewGrob
// When You Enter The Area, A Textdraw Will Show & Warn You To Leave
// The Textdraw Will Dissapear After 10 Seconds. Enjoy
// I Have Also Made A Goto/Teleport Command, It Will Teleport You To The Area
// Type In /ra To Go To The Radiation Area
// Just Remove It. Its Only Needed To Test The Script
// The Area Is 90 Radius so you will have to change it to 20 To Test It Faster
// Find---- if(IsPlayerInRangeOfPoint(i, 90.0, -1514.6758,2520.2603,55.9311)) {
// Change 90.0 To 20.0 For Testing Only!
#include <a_samp>
#define Black 0x000000AA
#define Red 0xAA3333AA
new Text:Textdraw8;
forward radiationarea();
forward textdrawtimer(playerid);
public OnFilterScriptInit()
{
SetTimer("radiationarea", 1000, 1);
Textdraw8= TextDrawCreate(300, 200,"RADIATION ZONE");
TextDrawAlignment(Textdraw8,2);
TextDrawBackgroundColor(Textdraw8,Black);
TextDrawFont(Textdraw8,2);
TextDrawLetterSize(Textdraw8,0.3,1.2);
TextDrawColor(Textdraw8,Red);
TextDrawSetOutline(Textdraw8,1);
TextDrawSetProportional(Textdraw8,1);
TextDrawSetShadow(Textdraw8,1);
return 1;
}

public radiationarea()
{
for(new i = 0; i <= MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(IsPlayerInRangeOfPoint(i, 20.0, -1514.6758,2520.2603,55.9311)) {
new Float:helf;
GetPlayerHealth(i, helf);
SetPlayerHealth(i, helf-3);
TextDrawShowForPlayer(i,Textdraw;
SetTimer("textdrawtimer", 10000, 1);
PlayAudioStreamForPlayer(i, "http://xenopixel.net/wp-content/uploads/2015/01/Geiger-counter-small.mp3");

}
if(IsPlayerInRangeOfPoint(i, 20.0, -1380.5601,2601.1104,55.1582)) {
new Float:helf;
GetPlayerHealth(i, helf);
SetPlayerHealth(i, helf-3);
TextDrawShowForPlayer(i,Textdraw;
SetTimer("textdrawtimer", 10000, 1);
}
if(IsPlayerInRangeOfPoint(i, 20.0, -1380.5601,2601.1104,55.1582)) {
new Float:helf;
GetPlayerHealth(i, helf);
SetPlayerHealth(i, helf-3);
TextDrawShowForPlayer(i,Textdraw;
SetTimer("textdrawtimer", 10000, 1);
}
if(IsPlayerInRangeOfPoint(i, 20.0, -1380.5601,2601.1104,55.1582)) {
new Float:helf;
GetPlayerHealth(i, helf);
SetPlayerHealth(i, helf-3);
TextDrawShowForPlayer(i,Textdraw;
SetTimer("textdrawtimer", 10000, 1);
}
if(IsPlayerInRangeOfPoint(i, 20.0, -1380.5601,2601.1104,55.1582)) {
new Float:helf;
GetPlayerHealth(i, helf);
SetPlayerHealth(i, helf-3);
TextDrawShowForPlayer(i,Textdraw;
SetTimer("textdrawtimer", 10000, 1);
}

return 1;
}
}
return 0;
}

public textdrawtimer(playerid)
{
TextDrawHideForPlayer(playerid,Textdraw;
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/ra", cmdtext, true, 2) == 0)
{
SetPlayerPos(playerid, -1514.6758,2520.2603,55.9311);
return 1;
}
return 0;
}




















Much thanks Duke <3
Reply
#2

Totally just noticed that i posted this in the wrong section* apolagies
Reply
#3

I think its better to post your problem here: https://sampforum.blast.hk/showthread.php?tid=560123
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)