GangsterAngel Posted October 5, 2005 Share Posted October 5, 2005 U have a small problem. im making a model preview on the player selection window. like the "Build A Jedi" model preview. i have a problem. i dont know how to get the left of '/' to get the model name. thats the only thing stopping my code from working . for example if i have "stormtrooper/default" as the 'Model' Cvar. strrchr(model,'/') would give me '/default' and i need to know what would return "stormtrooper/". Help appreciated. Link to comment Share on other sites More sharing options...
razorace Posted October 5, 2005 Share Posted October 5, 2005 char *point = strrchr(model,'/'); point++; //advances to the character after the '/'. point = '\0'; //sets the char to be the end of life special char. //At this point, your 'model' should read "stormtrooper/". I beleive this is how the rest of the code strips the strings like. Link to comment Share on other sites More sharing options...
GangsterAngel Posted October 6, 2005 Author Share Posted October 6, 2005 That seems to be returning (null) , thanx anyway though. Link to comment Share on other sites More sharing options...
razorace Posted October 6, 2005 Share Posted October 6, 2005 What is returning NULL? point or Model? Link to comment Share on other sites More sharing options...
GangsterAngel Posted October 6, 2005 Author Share Posted October 6, 2005 point. and model is the same as the "Model" cvar. Link to comment Share on other sites More sharing options...
razorace Posted October 6, 2005 Share Posted October 6, 2005 Point should be null, but model should have been truncated like you wanted. Link to comment Share on other sites More sharing options...
ensiform Posted October 6, 2005 Share Posted October 6, 2005 i believe he wants to see what model is not take out model. Link to comment Share on other sites More sharing options...
razorace Posted October 6, 2005 Share Posted October 6, 2005 Well, I told him who to do what he asked. Not sure exactly what his current problem is thou. Link to comment Share on other sites More sharing options...
GangsterAngel Posted October 7, 2005 Author Share Posted October 7, 2005 i have the skin name, i need the model name. //At this point, your 'model' should read "stormtrooper/". I beleive this is how the rest of the code strips the strings like. thats what i need, i need to get the modelname. but the code dosent seem to be working. Link to comment Share on other sites More sharing options...
razorace Posted October 7, 2005 Share Posted October 7, 2005 What is model outputing after my code? Link to comment Share on other sites More sharing options...
GangsterAngel Posted October 7, 2005 Author Share Posted October 7, 2005 same as the "Model" cvar. stormtrooper/default Link to comment Share on other sites More sharing options...
razorace Posted October 7, 2005 Share Posted October 7, 2005 hmm, could have sworn that that worked. try poking around in the code a bit more. I'm sure it's in there somewhere. Link to comment Share on other sites More sharing options...
GangsterAngel Posted October 14, 2005 Author Share Posted October 14, 2005 Got it working. //******************************* strcpy(modelStr,model); if ( ( skins = strchr( modelStr, '/' ) ) == NULL) { skins = "default"; } else { *skins++ = 0; } strcpy(skin,skins); //******************************* http://img299.imageshack.us/img299/513/ingamepreview0po.jpg Link to comment Share on other sites More sharing options...
razorace Posted October 14, 2005 Share Posted October 14, 2005 Ah, my bad. I missed the pointer reference when setting the end of file character. IE my sample code should have been.... char *point = strrchr(model,'/'); point++; //advances to the character after the '/'. *point = '\0'; //sets the char to be the end of life special char.' Good job figuring it out. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.