Strmid - Incorrect Usage?
#7

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
Why would you want to use strmid anyway?
pawn Код:
format(PlayerInformation[playerid][String], 64, "N/A");
Is a lot easier in your case.

If you wanted to use strmid, it would need to be this:
pawn Код:
new string[126];
format(string, 126, "N/A");
strmid(PlayerInformation[playerid][String], string, 0, strlen(string), 126);
I'm sure you can tell the difference between the two - using strmid brings in unneeded lines and usage. Normally you would use strmid for something like this:
pawn Код:
new string[126];
format(string, 126, "%s", GetPlayersName(playerid));
strmid(PlayerInformation[playerid][Name], string, 0, strlen(string), 126);
Even then, you can use format, which in my opinion is a lot easier, because it would turn into:
pawn Код:
format(PlayerInformation[playerid][Name], 126, "%s", GetPlayersName(playerid));
Don't! Format is slower - in fact, the best way to copy a string to another is memcpy or strcat (https://sampforum.blast.hk/showthread.php?tid=309130).
Reply


Messages In This Thread
Strmid - Incorrect Usage? - by DrakeX - 01.07.2014, 08:20
Re: Strmid - Incorrect Usage? - by Threshold - 01.07.2014, 09:15
Re: Strmid - Incorrect Usage? - by DrakeX - 01.07.2014, 10:38
Re: Strmid - Incorrect Usage? - by sammp - 01.07.2014, 10:47
Re: Strmid - Incorrect Usage? - by Jack_Leslie - 01.07.2014, 10:49
Re: Strmid - Incorrect Usage? - by Threshold - 01.07.2014, 12:33
Re: Strmid - Incorrect Usage? - by Konstantinos - 01.07.2014, 12:38

Forum Jump:


Users browsing this thread: 1 Guest(s)