Using strlen and a cutter to cut playername to two main letters
#2

pawn Код:
new name[MAX_PLAYER_NAME], letters[2][2];
//Get the first letter as we already know whats the position
format(letters[0], 2, "%s", name[0]);
//Loop through all of the letters in the name
for (new i = 0; i < MAX_PLAYER_NAME; i++) {
    //Check if this is the underscore we are looking for first
    if (name[i] == '_') {
        //Its the underscore, meaning the next letter will be +1 index ahead
            format(letters[1], 2, "%s", name[i+1]);
        // We dont need to search anything anymore as we found our letters already
            break;
    }
}

printf("%s %s", letters[0], letters[1]);
Not sure if works, havent tested this.
Reply


Messages In This Thread
Using strlen and a cutter to cut playername to two main letters - by BullseyeHawk - 09.04.2013, 20:15
Re: Using strlen and a cutter to cut playername to two main letters - by Universal - 09.04.2013, 20:21
Re: Using strlen and a cutter to cut playername to two main letters - by Jefff - 09.04.2013, 20:43
Re: Using strlen and a cutter to cut playername to two main letters - by BullseyeHawk - 10.04.2013, 10:55

Forum Jump:


Users browsing this thread: 1 Guest(s)