CMD:emscalls(playerid,params[]){
if(PlayerInfo[playerid][pFaction]!=FACTION_FMD)return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
SendClientMessage(playerid, COLOR_WHITE, "________________| Available EMS Calls |_________________");
new m[512],line[512];
for(new i=0;i<MAX_PLAYERS;i++){
if(EMSCall[i][ems_called]){
format(m, sizeof(m), "%i. %s - %s || Accepted by %s\n", i,PlayerICName(i), GetLocation(EMSCall[i][ems_pos][0], EMSCall[i][ems_pos][1], EMSCall[i][ems_pos][2]),PlayerICName(EMSCall[i][ems_acceptedby]));
strcat(m, line, sizeof(line));
}
}
SendClientMessage(playerid, 0xE4A3E2FF, line);
return 1;
}
[13:19:48] [DISPATCH] р Trainee Akib Khan accepted EMS call of . [13:19:49] ** You arrived at the scene **
CMD:acceptcall(playerid,params[]){
if(PlayerInfo[playerid][pFaction]!=FACTION_FMD)return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
new id,m[512];
if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_GREY, "Usage:{FFFFFF} /acceptcall [ID], use /emscalls to see available calls and their id.");
if(!EMSCall[id][ems_called]) return SendClientMessage(playerid, COLOR_RED, "Error:{FFFFFF} This player not called for EMS.");
if(EMSCall[id][ems_acceptedby]) return SendClientMessage(playerid, COLOR_GREY, "Someone already accepted this call.");
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, EMSCall[id][ems_pos][0], EMSCall[id][ems_pos][1], EMSCall[id][ems_pos][2], 1);
format(m, sizeof(m), "** %s %s responded to your EMS call, please wait **", fmdranks[PlayerInfo[playerid][pFRank]-1],PlayerICName(playerid));
SendClientMessage(id, COLOR_LIGHTBLUE, m);
SendFactionMessage(FACTION_FMD,0xE4A3E2FF,"[DISPATCH] %s %s accepted EMS call of %s.",fmdranks[PlayerInfo[playerid][pFRank]-1],PlayerICName(playerid),PlayerICName(id));
ShowPlayerFooter(id, "~y~Awaiting for EMS...");
EMSCall[id][ems_acceptedby]=playerid;
return 1;
}
new fmdranks[][][]={
{"Trainee","SAFMD Trainee"},
{"EMT-I","SAFMD EMT-I"},
{"EMT-II","SAFMD EMT-II"},
{"Paramedic","SAFMD Paramedic"},
{"District Chief","SAFMD District Chief"},
{"Chief","SAFMD Chief"}
};
It is not a dialog so you don't need to format, nor strcat, and in SendClientMessage, you cannot skip lines, even while using format. You should output each line separately, to achieve that put the SendClientMessage inside the loop, it will output every single call in a line.
|
CMD:emscalls(playerid,params[]){
if(PlayerInfo[playerid][pFaction]!=FACTION_FMD)return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
SendClientMessage(playerid, COLOR_WHITE, "________________| Available EMS Calls |_________________");
new m[512];
for(new i=0;i<MAX_PLAYERS;i++){
if(EMSCall[i][ems_called]){
format(m, sizeof(m), "%i. %s - %s || Accepted by %s\n", i,PlayerICName(i), GetPlayerZone(i),PlayerICName(EMSCall[i][ems_acceptedby]));
SendClientMessage(playerid, 0xE4A3E2FF, m);
}
}
return 1;
}
Yeah format the text, forgot about it.
Well then your check returns false, no one called or you didn't set the variable ems_called to true after a player calling. |
CMD:callems(playerid,params[]){
if(PlayerInfo[playerid][pInjured] != 1) return SendClientMessage(playerid, COLOR_RED, "Error:{FFFFFF} This command can be used only when you are injured.");
if(EMSCall[playerid][ems_called]) return SendClientMessage(playerid, COLOR_GREY, "You already called for EMS service, please wait...");
GetPlayerPos(playerid, EMSCall[playerid][ems_pos][0], EMSCall[playerid][ems_pos][1], EMSCall[playerid][ems_pos][2]);
if(EMSCall[playerid][ems_pos][0]==0.0000 && EMSCall[playerid][ems_pos][1]==0.0000&&EMSCall[playerid][ems_pos][2]==0.0000){
EMSCall[playerid][ems_pos][0] = PlayerInfo[playerid][pPosX];
EMSCall[playerid][ems_pos][1] = PlayerInfo[playerid][pPosY];
EMSCall[playerid][ems_pos][2] = PlayerInfo[playerid][pPosZ];
}
EMSCall[playerid][ems_called]=1;
SendFactionMessage(FACTION_FMD,0xE4A3E2FF,"[DISPATCH] %s is calling EMS at %s. (( Use /emscalls to list calls, /acceptcall to accept call. ))",PlayerICName(playerid),GetPlayerZone(playerid));
return 1;
}