Underscores
#1

I'm trying to save data, specifically a player's name as the owner of a vehicle dealership. I've got functions that gets a player's name(with underscores) and another one that removes the underscores. Now when I update the table for the dealerships to the player's name(with an underscore) it still removes it.

To make it simpler:
1. Player_Name connects, logs in, etc.
2. Buys a dealership, so it would be saved as "Player_Name" for the owner.
3. After buying, it saves as "Player Name" - obviously without the underscore.

Code for getting the name with an underscore:
pawn Код:
stock GetName(playerid) // Player name with underscore
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
Code for replacing the dealership's owner:
pawn Код:
strmid(Dealership[i][dOwner], GetName(playerid), 0, strlen(GetName(playerid)), 24);
I don't see anything wrong at all, could anyone suggest a solution for this? Thanks!
Edit: It's weird, since I use the same method when a player registers for an account and it saves the name with an underscore.
Reply
#2

Judging by the provided code that is not the problem. There is a line in your MySQL saving system removing the underscore.
Reply
#3

Well, if that's the case, this is what I'm currently using to save/update data:
pawn Код:
new query[128];
format(query, sizeof(query), "UPDATE dealerships SET owner='%s' WHERE id='%d'", Dealership[i][dOwner], i);
mysql_query(query);
Any thought on this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)