My Function Apprarently Not Used -
Robert_Crawford - 04.03.2012
I don't believe i set this up right.
pawn Код:
public RandomFireTimer()
{
if(FireManCount == 0) // If no players are on then....
{
TimerStarted = false;
KillTimer(Timer); // kill the timer.
}
else
new rndfire = random(sizeof(randomSpawns));
AddFire(randomSpawns[rndfire][0][0], randomSpawns[rndfire][0][1], randomSpawns[rndfire][0][2]);
AddFire(randomSpawns[rndfire][1][0], randomSpawns[rndfire][1][1], randomSpawns[rndfire][1][2]);
AddFire(randomSpawns[rndfire][2][0], randomSpawns[rndfire][2][1], randomSpawns[rndfire][2][2]);
AddFire(randomSpawns[rndfire][3][0], randomSpawns[rndfire][3][1], randomSpawns[rndfire][3][2]);
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] != 3)
{
SetPlayerMapIcon(playerid, 19, randomSpawns[rndfire][0][0], randomSpawns[rndfire][0][1], randomSpawns[rndfire][0][2], 55, COLOR_WHITE, 0);
SendClientMessage(playerid, COLOR_GREEN, "Dispatch: A Fire Has Been Located Please Respond We Have Set A Icon.");
}
return 1;
}
Re: My Function Apprarently Not Used -
Chrillzen - 04.03.2012
pawn Код:
public RandomFireTimer()
{
new rndfire = random(sizeof(randomSpawns));
AddFire(randomSpawns[rndfire][0][0], randomSpawns[rndfire][0][1], randomSpawns[rndfire][0][2]);
AddFire(randomSpawns[rndfire][1][0], randomSpawns[rndfire][1][1], randomSpawns[rndfire][1][2]);
AddFire(randomSpawns[rndfire][2][0], randomSpawns[rndfire][2][1], randomSpawns[rndfire][2][2]);
AddFire(randomSpawns[rndfire][3][0], randomSpawns[rndfire][3][1], randomSpawns[rndfire][3][2]);
if(FireManCount == 0) { // If no players are on then....
TimerStarted = false;
KillTimer(Timer); // kill the timer.
else if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] != 3) {
SetPlayerMapIcon(playerid, 19, randomSpawns[rndfire][0][0], randomSpawns[rndfire][0][1], randomSpawns[rndfire][0][2], 55, COLOR_WHITE, 0);
SendClientMessage(playerid, COLOR_GREEN, "Dispatch: A Fire Has Been Located Please Respond We Have Set A Icon.");
}
return 1;
}
Give me your errors.
Re: My Function Apprarently Not Used -
Robert_Crawford - 04.03.2012
Код:
C:\Users\HCC\Desktop\Linux-Server\gamemodes\vx-rp.pwn(5421) : warning 204: symbol is assigned a value that is never used: "Timer"
C:\Users\HCC\Desktop\Linux-Server\gamemodes\vx-rp.pwn(5421 -- 18104) : warning 203: symbol is never used: "randomSpawns"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Warnings.
Lines 513 - 518
pawn Код:
new Float:randomSpawns[][][3] =
{
{ {1535.6497,-1679.7516,13.3828}, {1535.6281,-1684.0664,13.5469}, {1535.6559,-1689.5146,13.5469}, {1535.5216,-1696.2633,13.5469} }, // fire 1
{ {1698.7971,1435.2810,10.7149}, {1702.1265,1432.8711,10.6901}, {1703.1891,1426.2205,10.6406}, {1703.6338,1420.9512,10.6484} }, // fire 2
{ {1172.3600,-1323.3131,15.4029}, {1175.4486,-1325.5078,14.3906}, {1178.7393,-1326.0090,14.1349}, {1182.5364,-1327.6281,13.5824} } //fire 3
};
Lines 17750 - 17767
pawn Код:
public RandomFireTimer()
{
new rndfire = random(sizeof(randomSpawns));
AddFire(randomSpawns[rndfire][0][0], randomSpawns[rndfire][0][1], randomSpawns[rndfire][0][2]);
AddFire(randomSpawns[rndfire][1][0], randomSpawns[rndfire][1][1], randomSpawns[rndfire][1][2]);
AddFire(randomSpawns[rndfire][2][0], randomSpawns[rndfire][2][1], randomSpawns[rndfire][2][2]);
AddFire(randomSpawns[rndfire][3][0], randomSpawns[rndfire][3][1], randomSpawns[rndfire][3][2]);
if(FireManCount == 0) { // If no players are on then....
TimerStarted = false;
KillTimer(Timer); // kill the timer.
else if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] != 3) {
SetPlayerMapIcon(playerid, 19, randomSpawns[rndfire][0][0], randomSpawns[rndfire][0][1], randomSpawns[rndfire][0][2], 55, COLOR_WHITE, 0);
SendClientMessage(playerid, COLOR_GREEN, "Dispatch: A Fire Has Been Located Please Respond We Have Set A Icon.");
}
return 1;
}
Re: My Function Apprarently Not Used -
Chrillzen - 04.03.2012
Those are just warning, anyway.
Try this.
pawn Код:
public RandomFireTimer()
{
new rndfire = random(sizeof(randomSpawns));
if(FireManCount == 0) { // If no players are on then....
TimerStarted = false;
KillTimer(Timer); // kill the timer.
else if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] != 3) {
SetPlayerMapIcon(playerid, 19, randomSpawns[rndfire][0][0], randomSpawns[rndfire][0][1], randomSpawns[rndfire][0][2], 55, COLOR_WHITE, 0);
AddFire(randomSpawns[rndfire][0][0], randomSpawns[rndfire][0][1], randomSpawns[rndfire][0][2]);
AddFire(randomSpawns[rndfire][1][0], randomSpawns[rndfire][1][1], randomSpawns[rndfire][1][2]);
AddFire(randomSpawns[rndfire][2][0], randomSpawns[rndfire][2][1], randomSpawns[rndfire][2][2]);
AddFire(randomSpawns[rndfire][3][0], randomSpawns[rndfire][3][1], randomSpawns[rndfire][3][2]);
SendClientMessage(playerid, COLOR_GREEN, "Dispatch: A Fire Has Been Located Please Respond We Have Set A Icon.");
}
return 1;
}
Re: My Function Apprarently Not Used -
Robert_Crawford - 04.03.2012
I would ignore it but the issue is the script is not functioning Same warnings by the way
Re: My Function Apprarently Not Used -
Chrillzen - 04.03.2012
Did you try my new code?
Re: My Function Apprarently Not Used -
Robert_Crawford - 04.03.2012
Yes same warnings and does not function
Re: My Function Apprarently Not Used -
Chrillzen - 04.03.2012
Well I cant fix it if you wont give me more information.
Re: My Function Apprarently Not Used -
Robert_Crawford - 04.03.2012
Okay what the system is supposed to do is when a fireman is online it's supposed to a fire object from a group of prelisted objects. So
Bool
pawn Код:
new Timer,FireManCount,bool:TimerStarted = false;
pawn Код:
new Float:randomSpawns[][][3] =
{
{ {1535.6497,-1679.7516,13.3828}, {1535.6281,-1684.0664,13.5469}, {1535.6559,-1689.5146,13.5469}, {1535.5216,-1696.2633,13.5469} }, // fire 1
{ {1698.7971,1435.2810,10.7149}, {1702.1265,1432.8711,10.6901}, {1703.1891,1426.2205,10.6406}, {1703.6338,1420.9512,10.6484} }, // fire 2
{ {1172.3600,-1323.3131,15.4029}, {1175.4486,-1325.5078,14.3906}, {1178.7393,-1326.0090,14.1349}, {1182.5364,-1327.6281,13.5824} } //fire 3
};
On Player Connect If The Players Group's Type Is Part Of Fire Dept +1 Is Added To The Fireman Count
pawn Код:
public OnPlayerSpawn(playerid) {
#if defined DEBUG
printf("[debug] OnPlayerSpawn(%d)", playerid);
#endif
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 4) // If the player is a cop then adds one to Cop Count
{
FireManCount++;
if(TimerStarted == false)
{
Timer = SetTimer("RandomFireTimer",5000,true); // Repeats a timer of 5 seconds
TimerStarted = true;
}
return 1;
}
On player disconnect then we remove one count
pawn Код:
public OnPlayerDisconnect(playerid, reason) {
#if defined DEBUG
printf("[debug] OnPlayerDisconnect(%d, %d)", playerid, reason);
#endif
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 4) // If the player is a cop then adds one to Cop Count
{
FireManCount--;
}
On the initiation of the game mode we set the count to zero
pawn Код:
public OnGameModeInit() {
AntiDeAMX();
initiateConnections();
#if defined DEBUG
mysql_debug(1);
print("[debug] OnGameModeInit()");
#endif
FireManCount = 0;
Re: My Function Apprarently Not Used -
Chrillzen - 04.03.2012
Where is the createobject code etc? Make sure there's nothing wrong with it.
What's the errors and warnings? (Of my new code). Including lines.