Sorry for the question, but
#1

ELoc[playerid][0] = text[0];

Why is that only grabbing the first letter?
Reply
#2

Can you show the whole OnPlayerText callback?
Reply
#3

Wow, lol ok.
pawn Код:
public OnPlayerText(playerid, text[])
{
   
    new pname[24];
    new string[256];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s says: %s", pname, text);
    if(PlayerData[OnCall][playerid] == 911) {
    format(string, sizeof(string), "%s says(Phone): %s", pname, text);
    ProxDetector(20.0,playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    if(EStage[playerid] == 1) {
    if(strcmp("police", text, true)) {
    SendClientMessage(playerid, White, "Please specify your location.");
    EStage[playerid] = 2;
    return 0;
    }
    if(strcmp("paramedic", text, true)) {
    SendClientMessage(playerid, White, "Please specify your location.");
    EStage[playerid] = 4;
    return 0;
    }
    if(strcmp("both", text, true)) {
    SendClientMessage(playerid, White, "Please specify your location.");
    EStage[playerid] = 6;
    return 0;
    }
    else {
    SendClientMessage(playerid, White, "I'm sorry, I do not understand that.");
    return 0;
    }
    }
   
    if(EStage[playerid] == 6) {
    ELoc[playerid][0] = text[0];
    SendClientMessage(playerid, White, "Please explain your situation.");
    EStage[playerid] = 7;
    return 0;
    }
    if(EStage[playerid] == 8) {
    ESit[playerid][0] = text[0];
    SendClientMessage(playerid, White, "Ok, sit tight, they have been notified.");
    for(new i; i < MAX_PLAYERS; i ++) {
    if(PlayerData[RChannel][i] == 912 || PlayerData[RChannel][i] == 913) {
    SendClientMessage(playerid, White, "Auto Dispatch: We have an emergency call.");
    format(string, sizeof(string), "Location: %s", ELoc[playerid]);
    SendClientMessage(playerid, White, string);
    format(string, sizeof(string), "Situation: %s", ESit[playerid]);
    SendClientMessage(playerid, White, string);
    }
    }
    return 0;
    }

   
    if(EStage[playerid] == 4) {
    ELoc[playerid][0] = text[0];
    SendClientMessage(playerid, White, "Please explain your situation.");
    EStage[playerid] = 3;
    return 0;
    }
    if(EStage[playerid] == 5) {
    ESit[playerid][0] = text[0];
    SendClientMessage(playerid, White, "Ok, sit tight, Paramedics have been notified.");
    for(new i; i < MAX_PLAYERS; i ++) {
    if(PlayerData[RChannel][i] == 913) {
    SendClientMessage(playerid, White, "Auto Dispatch: We have an emergency call.");
    format(string, sizeof(string), "Location: %s", ELoc[playerid]);
    SendClientMessage(playerid, White, string);
    format(string, sizeof(string), "Situation: %s", ESit[playerid]);
    SendClientMessage(playerid, White, string);
    }
    }
    return 0;
    }


   
   
    if(EStage[playerid] == 2) {
    ELoc[playerid][0] = text[0];
    SendClientMessage(playerid, White, "Please explain your situation.");
    EStage[playerid] = 3;
    return 0;
    }
    if(EStage[playerid] == 3) {
    ESit[playerid][0] = text[0];
    SendClientMessage(playerid, White, "Ok, sit tight, Police have been notified.");
    for(new i; i < MAX_PLAYERS; i ++) {
    if(PlayerData[RChannel][i] == 912) {
    SendClientMessage(playerid, White, "Auto Dispatch: We have an emergency call.");
    format(string, sizeof(string), "Location: %s", ELoc[playerid]);
    SendClientMessage(playerid, White, string);
    format(string, sizeof(string), "Situation: %s", ESit[playerid]);
    SendClientMessage(playerid, White, string);
    }
    }
    }
    return 0;
    }


    if(PlayerData[OnCall][playerid] != -1 && PlayerData[PickedUp][PlayerData[OnCall][playerid]]) {
    SendClientMessage(PlayerData[OnCall][playerid], Yellow1, string);
    format(string, sizeof(string), "%s says(Phone): %s", pname, text);
    ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    return 0;
    }
    ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    return 0;
}
Reply
#4

Quote:
Originally Posted by zallomallo
ELoc[playerid][0] = text[0];

Why is that only grabbing the first letter?
Because 'text[0]' is the first cell of 'text', and each character in a string use one cell.
Reply
#5

I know that, but when I removed [ 0] from text I get: error 006: must be assigned to an array
Reply
#6

Do not use [] ...........

ELoc[playerid] = text;


Thank You
Abhinav
Reply
#7

Then I get error 047: array sizes do not match, or destination array is too small.

My declaration

new ELoc[MAX_PLAYERS][257];
new ESit[MAX_PLAYERS][257];
Reply
#8

so code for that declaration is
Код:
ELoc[playerid]=ESit[playerid];
Or If you want to Put the data from ELoc to text then it would be :
Код:
ELoc[playerid]=text;
It was working on mine, now you test it...
Tell me if still no success...i would be greatful to help.

TIP: I recommend you to put sizes like 256, 512 or 128 coz 257 figure looks ...looks like ....SHIT ..lol...no offence ...

Thank You
Abhinav
Reply
#9

It still says: error 047: array sizes do not match, or destination array is too small. Thanks for the help, btw.
Reply
#10

I don't know what is happening at your side, but i tried the same code , and it was working. If your code is personal and confidential, PM me.

Thank You
Abhinav
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)