27.12.2015, 22:31
Hello so I am confused as to why my GiveNameSpace is not removing the underscore. Thanks for the replys.
Код:
stock GetPlayerNameEx(playerid,ENameType:type) { new name[MAX_PLAYER_NAME+1]; //SetPVarString(playerid,"CharUsername",id_string); if(IsPlayerConnected(playerid)) { switch(type) { case ENameType_AccountName: { GetPVarString(playerid,"AccountName",name,MAX_PLAYER_NAME); } case ENameType_RPName: { new maskid = GetPVarInt(playerid, "MaskID"); if(GetPVarInt(playerid, "MaskOn") != 1) { GetPVarString(playerid,"CharUsername",name,MAX_PLAYER_NAME); } else { format(name, sizeof(name), "Stranger_%d",maskid); } GiveNameSpace(name); } case ENameType_CharName: { GetPVarString(playerid,"CharUsername",name,MAX_PLAYER_NAME); } case ENameType_RPName_NoMask: { GetPVarString(playerid,"CharUsername",name,MAX_PLAYER_NAME); GiveNameSpace(name); } case ENameType_Phone_Name: { GetPVarString(playerid,"CharUsername",name,MAX_PLAYER_NAME); if(GetPVarInt(playerid, "PhoneStatus") == 1) { strmid(name,"Anonymous",0,9,MAX_PLAYER_NAME); } if(GetPVarInt(playerid, "PhoneStatus") == 3) { strmid(name,"Payphone",0,9,MAX_PLAYER_NAME); } GiveNameSpace(name); } } if(strlen(name) < 1) { //null name(either not logged in or a bug happend to them GetPlayerName(playerid, name, sizeof(name)); } } else { GetPlayerName(playerid, name, sizeof(name)); } return name; }
Код:
GiveNameSpace(str[]) { new strl; strl=strlen(str); while(strl--) { if(str[strl]=='_') str[strl]=' '; } return 0; }