Jump to content
  • 0

Litera mare


Guest Alxxie

Question

Guest Alxxie

Vreau ca la inceputul unei propozitii prima litera sa fie mare(se vede mai frumos asa).Adica daca cineva scrie "salut" sa apara "Salut".

Am incercat asa:

public OnPlayerText(playerid, text[])
{
    if(text[0] == 'a') return text[0]='A';
    if(text[0] == 'b') return text[0]='B';
    if(text[0] == 'c') return text[0]='C';
    if(text[0] == 'd') return text[0]='D';
    if(text[0] == 'e') return text[0]='E';
    if(text[0] == 'f') return text[0]='F';
    if(text[0] == 'g') return text[0]='G';
    if(text[0] == 'h') return text[0]='H';
    if(text[0] == 'i') return text[0]='I';
    if(text[0] == 'j') return text[0]='J';
    if(text[0] == 'k') return text[0]='K';
    if(text[0] == 'l') return text[0]='L';
    if(text[0] == 'm') return text[0]='M';
    if(text[0] == 'n') return text[0]='N';
    if(text[0] == 'o') return text[0]='O';
    if(text[0] == 'p') return text[0]='P';
    if(text[0] == 'q') return text[0]='Q';
    if(text[0] == 'r') return text[0]='R';
    if(text[0] == 's') return text[0]='S';
    if(text[0] == 't') return text[0]='T';
    if(text[0] == 'u') return text[0]='U';
    if(text[0] == 'v') return text[0]='V';
    if(text[0] == 'x') return text[0]='X';
    if(text[0] == 'y') return text[0]='Y';
    if(text[0] == 'z') return text[0]='Z';
}
Dar imi da warning:
D:\Jocuri\SERVER~1.3\FILTER~1\MICSCR~1.PWN(30) : warning 209: function "OnPlayerText" should return a value
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.

Inafara de asta am mai incercat intr-un fel dar daca scriu eu din start prima litera mare, mesajul meu nu apare in chat...

Deci cum fac ca sa mearga si sa nu-mi dea warn? :P

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

inlocuieste

public OnPlayerText(playerid, text[])
{
    if(text[0] == 'a') return text[0]='A';
    if(text[0] == 'b') return text[0]='B';
    if(text[0] == 'c') return text[0]='C';
    if(text[0] == 'd') return text[0]='D';
    if(text[0] == 'e') return text[0]='E';
    if(text[0] == 'f') return text[0]='F';
    if(text[0] == 'g') return text[0]='G';
    if(text[0] == 'h') return text[0]='H';
    if(text[0] == 'i') return text[0]='I';
    if(text[0] == 'j') return text[0]='J';
    if(text[0] == 'k') return text[0]='K';
    if(text[0] == 'l') return text[0]='L';
    if(text[0] == 'm') return text[0]='M';
    if(text[0] == 'n') return text[0]='N';
    if(text[0] == 'o') return text[0]='O';
    if(text[0] == 'p') return text[0]='P';
    if(text[0] == 'q') return text[0]='Q';
    if(text[0] == 'r') return text[0]='R';
    if(text[0] == 's') return text[0]='S';
    if(text[0] == 't') return text[0]='T';
    if(text[0] == 'u') return text[0]='U';
    if(text[0] == 'v') return text[0]='V';
    if(text[0] == 'x') return text[0]='X';
    if(text[0] == 'y') return text[0]='Y';
    if(text[0] == 'z') return text[0]='Z';
}
cu
public OnPlayerText(playerid, text[])
{
    if(text[0] == 'a') return text[0]='A';
    if(text[0] == 'b') return text[0]='B';
    if(text[0] == 'c') return text[0]='C';
    if(text[0] == 'd') return text[0]='D';
    if(text[0] == 'e') return text[0]='E';
    if(text[0] == 'f') return text[0]='F';
    if(text[0] == 'g') return text[0]='G';
    if(text[0] == 'h') return text[0]='H';
    if(text[0] == 'i') return text[0]='I';
    if(text[0] == 'j') return text[0]='J';
    if(text[0] == 'k') return text[0]='K';
    if(text[0] == 'l') return text[0]='L';
    if(text[0] == 'm') return text[0]='M';
    if(text[0] == 'n') return text[0]='N';
    if(text[0] == 'o') return text[0]='O';
    if(text[0] == 'p') return text[0]='P';
    if(text[0] == 'q') return text[0]='Q';
    if(text[0] == 'r') return text[0]='R';
    if(text[0] == 's') return text[0]='S';
    if(text[0] == 't') return text[0]='T';
    if(text[0] == 'u') return text[0]='U';
    if(text[0] == 'v') return text[0]='V';
    if(text[0] == 'x') return text[0]='X';
    if(text[0] == 'y') return text[0]='Y';
    if(text[0] == 'z') return text[0]='Z';
    return 1;
}

Link to comment
Share on other sites

Sau mai ai o solutie :

new count;

while(text[count]==' ')count++;

text[count] = toupper(text[count]);

PS : poti pune text[count] = toupper(text[count]); si pe celelalte chaturi (ex: /a , /ooc . etc.)

Sau asta la comenzile gen /a /o si etc, mult mai simplu:

result[0] = toupper(result[0]);

Sau cum a zis monster. :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.