[SOLVED] Underscore
#4

Код:
new name[MAX_PLAYER_NAME],tmp5[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME]);
tmp5 = strreplace("_"," ",name);
SetPlayerName(playerid,tmp5);
Код:
stock strreplace(trg[],newstr[],src[]) { //dutils
  new f=0;
  new s1[MAX_STRING];
  new tmp[MAX_STRING];
  format(s1,sizeof(s1),"%s",src);
  f = strfind(s1,trg);
  tmp[0]=0;
  while (f>=0) {
    strcat(tmp,ret_memcpy(s1, 0, f));
    strcat(tmp,newstr);
    format(s1,sizeof(s1),"%s",ret_memcpy(s1, f+strlen(trg), strlen(s1)-f));
    f = strfind(s1,trg);
  }
  strcat(tmp,s1);
  return tmp;
}
Код:
ret_memcpy(source[],index=0,numbytes) {
	new tmp[MAX_STRING];
	new i=0;
	tmp[0]=0;
	if (index>=strlen(source)) return tmp;
	if (numbytes+index>=strlen(source)) numbytes=strlen(source)-index;
	if (numbytes<=0) return tmp;
	for (i=index;i<numbytes+index;i++) {
		tmp[i-index]=source[i];
		if (source[i]==0) return tmp;
	}
	tmp[numbytes]=0;
	return tmp;
}
EDIT: Virtual1ty was first :b
Reply


Messages In This Thread
[SOLVED] Underscore - by KnooL - 12.01.2010, 14:37
Re: [UNSOLVED] Underscore - by RyDeR` - 12.01.2010, 14:44
Re: [UNSOLVED] Underscore - by Virtual1ty - 12.01.2010, 14:50
Re: [UNSOLVED] Underscore - by GTAguillaume - 12.01.2010, 14:51
Re: [UNSOLVED] Underscore - by KnooL - 12.01.2010, 19:38
Re: [UNSOLVED] Underscore - by KnooL - 13.01.2010, 16:03
Re: [UNSOLVED] Underscore - by AiVAMAN - 13.01.2010, 16:20
Re: [UNSOLVED] Underscore - by Sergei - 13.01.2010, 16:22
Re: [UNSOLVED] Underscore - by KnooL - 13.01.2010, 16:52
Re: [UNSOLVED] Underscore - by Kurence - 13.01.2010, 17:26

Forum Jump:


Users browsing this thread: 2 Guest(s)