30.01.2011, 20:18
(
Последний раз редактировалось Ihsan-Cingisiz; 31.01.2011 в 06:15.
)
Hello,
This is my very first tutorial where I want to teach the new RP scripters
to delete the '_' in RP names. Ex. Ihsan_Cingisiz - Ihsan Cingisiz. I wanted
to make this tutorial because I was unable to find a simple tutorial for this
script, and it's so easy, super noob-friendly.
Okay, now i'll give you a example:
Okay, we've defined the player name into the variable 'name'.
Now we want to delete the '_' in the name, if the player has one.
We'll add this under the GetPlayerName(...));
So the name was the variable where we defined the players
name in. I gave the name variables a color in case the new scripters
get confused with it.
Okay, so this is the full code for now:
Now we'll format the string to show the name.
(This is not a tutorial of how to format strings so there's not a
full explain of it.)
Okay, and now end all the script with return and close brackets.
The full code is:
This was my first tutorial.
I hope you learned something from it, I know it's not a really big tutorial,
but I didn't want to only follow tutorial but make one.
I hope to see you all on my next tutorial!
- Oh, sorry, the colors didn't work so i must delete them, if you're confused anyway
you're always welcome to leave a reaction/answer.
This is my very first tutorial where I want to teach the new RP scripters
to delete the '_' in RP names. Ex. Ihsan_Cingisiz - Ihsan Cingisiz. I wanted
to make this tutorial because I was unable to find a simple tutorial for this
script, and it's so easy, super noob-friendly.
Okay, now i'll give you a example:
pawn Код:
if(strcmp(cmdtext, "/showmyname", true) == 0)
{
new name[MAX_PLAYER_NAME], str[64];
GetPlayerName(playerid, name, sizeof(name));
Now we want to delete the '_' in the name, if the player has one.
We'll add this under the GetPlayerName(...));
pawn Код:
if(strfind(name,"_",true) == -1)return SendClientMessage(playerid,0xFF0000FF,"Your name must include an underscore for this command to work. Ex Ihsan_Cingisiz");
name[strfind(name, "_")] = ' ';
name in. I gave the name variables a color in case the new scripters
get confused with it.
Okay, so this is the full code for now:
pawn Код:
if(strcmp(cmdtext, "/showmyname", true) == 0)
{
new name[MAX_PLAYER_NAME, str[64];
GetPlayerName(playerid, name, sizeof(name));
if(strfind(name,"_",true) == -1)return SendClientMessage(playerid,0xFF0000FF,"Your name must include an underscore for this command to work. Ex Ihsan_Cingisiz");
name[strfind(name,"_")] = ' ';
(This is not a tutorial of how to format strings so there's not a
full explain of it.)
pawn Код:
format(str, sizeof(str), "Your name is: %s", name);
The full code is:
pawn Код:
if(strcmp(cmdtext, "/showmyname", true) == 0)
{
new name[MAX_PLAYER_NAME, str[64];
GetPlayerName(playerid, name, sizeof(name));
name[strfind(name,"_")] = ' ';
format(str, sizeof(str), "Your name is: %s", name);
SendClientMessage(playerid, 0xFFFFFFFF, str);
return 1;
}
I hope you learned something from it, I know it's not a really big tutorial,
but I didn't want to only follow tutorial but make one.
I hope to see you all on my next tutorial!
- Oh, sorry, the colors didn't work so i must delete them, if you're confused anyway
you're always welcome to leave a reaction/answer.