30.04.2015, 17:12
pawn Код:
stock NombreJ(playerid)
{
new nombrePJ[MAX_PLAYER_NAME];
if(Desconocido[playerid] == 1) format(nombrePJ, sizeof(nombrePJ), "Desconocido");
else
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(nombrePJ, sizeof(nombrePJ), "%s", ReplaceString("_", " ", name));
}
return nombrePJ;
}
stock ReplaceString(search[], replace[], source[])
{
new newstring[256], newlen;
for(new i; i < strlen(source); i++)
{
if(strlen(search) > 1 && i != (strlen(source) - 1))
{
new matched = 1, start = i;
for(new s = 0; s < strlen(search) && matched == 1; s++)
{
if(source[i] != search[s] && s == 0)
{
newstring[newlen] = source[i];
matched = 0;
}
else
{
if(source[i] == search[s]) i++;
else matched = 0;
}
}
if(matched == 0)
{
while(start <= i)
{
newstring[newlen] = source[start];
newlen++;
start++;
}
}
else
{
for(new r; r < strlen(replace); r++)
{
newstring[newlen] = replace[r];
newlen++;
}
i = (start + (strlen(search) - 1));
}
}
else
{
if(strlen(search) == 1 && source[i] == search[0])
{
for(new r; r < strlen(replace); r++)
{
newstring[newlen] = replace[r];
newlen++;
}
}
else
{
newstring[newlen] = source[i];
newlen++;
}
}
}
newstring[newlen] = EOS;
return newstring;
}
Y es pawn, no pawno. pawn es el lenguaje de programacion y pawno es el programa que utlizas para hacer codigo en pawn.