Command not working perfectly
#1

It's not showing available ems calls
PHP код:
CMD:emscalls(playerid,params[]){
    if(
PlayerInfo[playerid][pFaction]!=FACTION_FMD)return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    
SendClientMessage(playeridCOLOR_WHITE"________________| Available EMS Calls |_________________");
    new 
m[512],line[512];
    for(new 
i=0;i<MAX_PLAYERS;i++){
        if(
EMSCall[i][ems_called]){
            
format(msizeof(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(mlinesizeof(line));
        }
    }
    
SendClientMessage(playerid0xE4A3E2FFline);
    return 
1;

Another scripting problem is in name,

Код:
[13:19:48] [DISPATCH] р Trainee Akib Khan accepted EMS call of .

[13:19:49] ** You arrived at the scene **
р < This sybmol

Code:
PHP код:
CMD:acceptcall(playerid,params[]){
    if(
PlayerInfo[playerid][pFaction]!=FACTION_FMD)return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    new 
id,m[512];
    if(
sscanf(params"i"id)) return SendClientMessage(playeridCOLOR_GREY"Usage:{FFFFFF} /acceptcall [ID], use /emscalls to see available calls and their id.");
    if(!
EMSCall[id][ems_called]) return SendClientMessage(playeridCOLOR_RED"Error:{FFFFFF} This player not called for EMS.");
    if(
EMSCall[id][ems_acceptedby]) return SendClientMessage(playeridCOLOR_GREY"Someone already accepted this call.");
    
DisablePlayerCheckpoint(playerid);
    
SetPlayerCheckpoint(playeridEMSCall[id][ems_pos][0], EMSCall[id][ems_pos][1], EMSCall[id][ems_pos][2], 1);
    
format(msizeof(m), "** %s %s responded to your EMS call, please wait **"fmdranks[PlayerInfo[playerid][pFRank]-1],PlayerICName(playerid));
    
SendClientMessage(idCOLOR_LIGHTBLUEm);
    
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;

Thats the fmdranks variable
PHP код:
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"}
}; 
Reply
#2

Name bug fixed, someone help me with /emscalls
Reply
#3

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.
Reply
#4

Quote:
Originally Posted by TheToretto
Посмотреть сообщение
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.
I have to use format to format the text
Btw I used SendClientMessage inside the loop, no result

PHP код:
CMD:emscalls(playerid,params[]){
    if(
PlayerInfo[playerid][pFaction]!=FACTION_FMD)return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    
SendClientMessage(playeridCOLOR_WHITE"________________| Available EMS Calls |_________________");
    new 
m[512];
    for(new 
i=0;i<MAX_PLAYERS;i++){
        if(
EMSCall[i][ems_called]){
            
format(msizeof(m), "%i. %s - %s || Accepted by %s\n"i,PlayerICName(i), GetPlayerZone(i),PlayerICName(EMSCall[i][ems_acceptedby]));
            
SendClientMessage(playerid0xE4A3E2FFm);
        }
    }
    return 
1;

Reply
#5

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.
Reply
#6

Quote:
Originally Posted by TheToretto
Посмотреть сообщение
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.
I have done this,
PHP код:
CMD:callems(playerid,params[]){
    if(
PlayerInfo[playerid][pInjured] != 1) return SendClientMessage(playeridCOLOR_RED"Error:{FFFFFF} This command can be used only when you are injured.");
    if(
EMSCall[playerid][ems_called]) return SendClientMessage(playeridCOLOR_GREY"You already called for EMS service, please wait...");
    
GetPlayerPos(playeridEMSCall[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;

Reply
#7

Make sure you call ems before seeking for calls
Reply
#8

Quote:
Originally Posted by TheToretto
Посмотреть сообщение
Make sure you call ems before seeking for calls
Sorry didn't get you :/
Reply
#9

Use /callems ingame, it shouldn't output a thing, then do it again and it should output "You already called..."

Then execute the command /emscalls, your call should be listed.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)