string bug
#1

pawn Код:
CMD:s(playerid,params[])
{
      if(zInfo[playerid][adminlvl]==0) return 0;
      new kokieadmin [512], tekstas[900], Zinute[256];
      if(zInfo[playerid][adminlvl] == 1) kokieadmin = "Administratorius {FFFF00}I{00FF00} lygio";
      if(zInfo[playerid][adminlvl] == 2) kokieadmin = "Administratorius {FFFF00}II{00FF00} lygio";
      if(zInfo[playerid][adminlvl] == 3) kokieadmin = "Administratorius {FFFF00}III{00FF00} lygio";
      if(zInfo[playerid][adminlvl] == 4) kokieadmin = "Savininkas";
      if(zInfo[playerid][adminlvl] == 5) kokieadmin = "Scripteris";
      if(zInfo[playerid][emigrator]) kokieadmin = "{FFFF00}Emigracijų{00FF00} priћiūrėtojas";
      if(zInfo[playerid][adminator]) kokieadmin = "{FFFF00}Administratorių{00FF00} priћiūrėtojas";
      if(zInfo[playerid][vipator]) kokieadmin = "{FFFF00}Vipų{00FF00} priћiūrėtojas";
      if(zInfo[playerid][prezidentas]) kokieadmin = "{FFFF00}Direktorių{00FF00} priћiūrėtojas";
      if(sscanf(params, "s",tekstas)) return SendClientMessage(playerid, BLUE, "* Raљyti praneљima ћaidėjams: /s [Tekstas]");
      new vardas[MAX_PLAYER_NAME];
      GetPlayerName(playerid,vardas,MAX_PLAYER_NAME);
      format(kokieadmin,sizeof(kokieadmin),"{00FF00}%s {FFFF00}%s {00FF00}praneљa:",kokieadmin,vardas);
      format(Zinute,sizeof(Zinute),"{009966}%s",tekstas);
      SendClientMessageToAll( -1, kokieadmin );
      SendClientMessageToAll( -1, Zinute );
      return 1;
}
why Zinute is showing me only like 30 symbols?
Reply
#2

make another string and use it
Reply
#3

Quote:
Originally Posted by Vanter
Посмотреть сообщение
make another string and use it
not helping
Reply
#4

pawn Код:
CMD:s(playerid, params[])
{
    if (!zInfo[playerid][adminlvl]) return 0;
    if (isnull(params)) return SendClientMessage(playerid, BLUE, "* Rašyti pranešima žaidėjams: /s [Tekstas]");
   
    new _str[128];
   
    switch (zInfo[playerid][adminlvl])
    {
        case 1: _str = "Administratorius {FFFF00}I{00FF00} lygio";
        case 2: _str = "Administratorius {FFFF00}II{00FF00} lygio";
        case 3: _str = "Administratorius {FFFF00}III{00FF00} lygio";
        case 4: _str = "Savininkas";
        case 5: _str = "Scripteris";
        default:
        {
            if(zInfo[playerid][emigrator]) _str = "{FFFF00}Emigracijų{00FF00} prižiūrėtojas";
            else if(zInfo[playerid][adminator]) _str = "{FFFF00}Administratorių{00FF00} prižiūrėtojas";
            else if(zInfo[playerid][vipator]) _str = "{FFFF00}Vipų{00FF00} prižiūrėtojas";
            else if(zInfo[playerid][prezidentas]) _str = "{FFFF00}Direktorių{00FF00} prižiūrėtojas";
        }
    }
   
    new vardas[MAX_PLAYER_NAME];
    GetPlayerName(playerid, vardas, MAX_PLAYER_NAME);
    format(_str, sizeof (_str), "{00FF00}%s {FFFF00}%s {00FF00}praneša:", _str, vardas);
    SendClientMessageToAll(-1, _str);
    format(_str, sizeof (_str), "{009966}%s", params);
    SendClientMessageToAll(-1, _str);
    return 1;
}
Reply
#5

This doesnt make a sense

tekstas[900], Zinute[256];

you format tekstas with 900 chars, while Zinute is only 256, tekstas should be something below 256

For testing add print(tekstas); under SendClientMessageToAll( -1, Zinute );
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)