HELP! Auto-Mated Fire Dispatch -
[LSR]State_Trooper - 21.12.2009
Hey everyone,
I need some help making an automated Fire Dispatch,
When I say Automated I mean A message is sent to a faction and an Explosion/Fire is Created,
EG of Message:
================================
Automated Fire Dispatch
Location:
Incident Details:
Recommended Action: // This would be default Set
====================================
Something Like that, I am working with dynamic factions. I'm not a No0b and I can script but I have tried this twice and eachtime Something went wrong.
Please Help me, All Replies are appreciated.
Regards,
State Trooper / SuperTrooper
Re: HELP! Auto-Mated Fire Dispatch -
[LSR]State_Trooper - 21.12.2009
Anyone??
Re: HELP! Auto-Mated Fire Dispatch -
Rzzr - 21.12.2009
You said you tried twice.
Could you show some code?
And plz do not bump
Re: HELP! Auto-Mated Fire Dispatch -
[LSR]State_Trooper - 21.12.2009
I believe it was something like this, I am going to use the CreateExplosion fucntion once I get this working. The whole idea is so when the mesage is sent randomly the Explosion is made. and the FD personel would have to go there and put it out but they explosions would happen randomly.
Код:
if(strcmp(cmd, "/fddispatch", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 5)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /Firedispatch");
return 1;
}
if(CopOnDuty[playerid])
{
format(string, sizeof(string), "==========================================================",result);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "Fire Dispatch",result);
SendFactionTypeMessage(11, COLOR_RED, string);
format(string, sizeof(string), "Reporter: %s ",GetPlayerNameEx(giveplayerid));
SendFactionTypeMessage(11,COLOR_LSPD,string);
new location[MAX_ZONE_NAME];
GetPlayer2DZone(giveplayerid, location, MAX_ZONE_NAME);
format(string, sizeof(string), "Location %s",location);
SendFactionTypeMessage(11,COLOR_LIGHTGREEN,string);
SendFactionTypeMessage(11,COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "Details: %s ",result);
format(string, sizeof(string), "==========================================================",result);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] ");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not on duty");
}
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid faction");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid ID/Name");
return 1;
}
return 1;
}
}
Re: HELP! Auto-Mated Fire Dispatch -
[LSR]State_Trooper - 21.12.2009
Quote Modify
--------------------------------------------------------------------------------
I believe it was something like this, I am going to use the CreateExplosion fucntion once I get this working. The whole idea is so when the mesage is sent randomly the Explosion is made. and the FD personel would have to go there and put it out but they explosions would happen randomly.
Code:
if(strcmp(cmd, "/fddispatch", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 5)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /Firedispatch");
return 1;
}
if(CopOnDuty[playerid])
{
format(string, sizeof(string), "================================================= =========",result);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "Fire Dispatch",result);
SendFactionTypeMessage(11, COLOR_RED, string);
format(string, sizeof(string), "Reporter: %s ",GetPlayerNameEx(giveplayerid));
SendFactionTypeMessage(11,COLOR_LSPD,string);
new location[MAX_ZONE_NAME];
GetPlayer2DZone(giveplayerid, location, MAX_ZONE_NAME);
format(string, sizeof(string), "Location %s",location);
SendFactionTypeMessage(11,COLOR_LIGHTGREEN,string) ;
SendFactionTypeMessage(11,COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "Details: %s ",result);
format(string, sizeof(string), "================================================= =========",result);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] ");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not on duty");
}
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid faction");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid ID/Name");
return 1;
}
return 1;
}
Re: HELP! Auto-Mated Fire Dispatch -
[LSR]State_Trooper - 21.12.2009
Cant any one help??
Re: HELP! Auto-Mated Fire Dispatch -
lolumadd - 21.12.2009
You said you want it to be called everytime a explosion is made? Well that is easy, just make another function.
pawn Код:
forward ExplosionFireDepartment(Float:X, Float:Y, Float:Z, type, Float:Radius);
public ExplosionFireDepartment(Float:X, Float:Y, Float:Z, type, Float:Radius)
{
CreateExplosion(X, Y, Z, type, Radius);
for(new i=0; <MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i]==TEAM_FIREMAN)
{
SendClientMessage(i, color, "[DISPATCH]Fire at LOL! Follow the checkpoint!");
SetPlayerCheckpoint(i, X, Y, Z);
}
}
return 1;
}
Use that code instead, its the same as CreateExplosion but it calls the fire department. You need to edit it a little depending on your code.
NOTE: Not tested :P
Re: HELP! Auto-Mated Fire Dispatch -
[LSR]State_Trooper - 21.12.2009
Thans, Will try in the morning. Going to sleep now.