How to do this things?
#1

Hi,
How to divide player first name and last name....
example:
Код:
new m[126];
format(m,sizeof(m),"Your first name is %s",firstname);
SendClientMessage(playerid,-1,m);
and 2nd function is...
How to do random colors?
Onplayer login
show player login dialog
in login dialog


Welcome [Random Color]Playername
Reply
#2

PHP код:
new rand random(5);
switch(
rand)
{
    case 
0format(m,sizeof(m),"Your first name is {00FF00}%s",firstname);  //green
    
case 1format(m,sizeof(m),"Your first name is {FF0000}%s",firstname); //red
    
case 2format(m,sizeof(m),"Your first name is {FFFF00}%s",firstname); //yellow
    //etc
}
SendClientMessage(playerid, -1m); 
Reply
#3

Quote:
Originally Posted by Whatname
Посмотреть сообщение
PHP код:
new rand random(5);
switch(
rand)
{
    case 
0format(m,sizeof(m),"Your first name is {00FF00}%s",firstname);  //green
    
case 1format(m,sizeof(m),"Your first name is {FF0000}%s",firstname); //red
    
case 2format(m,sizeof(m),"Your first name is {FFFF00}%s",firstname); //yellow
    //etc
}
ShowPlayerDialog(playeriddialogidtype"header"m"Ok"""); 
i said how to divide first name and last name -_-
Reply
#4

Quote:
Originally Posted by akib
Посмотреть сообщение
i said how to divide first name and last name -_-
You also asked "How to do random colors?"
Reply
#5

Quote:
Originally Posted by Whatname
Посмотреть сообщение
You also asked "How to do random colors?"

Код:
format(string, sizeof string, "{FFFFF}Welcome {do here random color}%s{FFFFFF}\n{FFFFFF}Please register by entering your password in the field below:", Player[playerid][Name]);
		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "BARP | Registration", string, "Register", "Abort");
Reply
#6

God damn... some people...

http://lmgtfy.com/?q=samp%20divide%2...%20last%20name

Not that hard, honestly.
Reply
#7

-REMOVED-
Reply
#8

Quote:
Originally Posted by Whatname
Посмотреть сообщение
PHP код:
new rand random(5);
switch(
rand)
{
    case 
0format(m,sizeof(m),"Your first name is {00FF00}%s",firstname);  //green
    
case 1format(m,sizeof(m),"Your first name is {FF0000}%s",firstname); //red
    
case 2format(m,sizeof(m),"Your first name is {FFFF00}%s",firstname); //yellow
    //etc
}
SendClientMessage(playerid, -1m); 
https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
Reply
#9

Quote:
Originally Posted by Vince
Посмотреть сообщение
Ok

PHP код:
#include <a_samp>
#include <izcmd>
static const RandCol[][]=
{
     
"{00FF00}""{FF0000}""{FFFF00}"
};
CMD:testrcol(playeridparams[])
{
     new 
string[15];
     new 
rand random(sizeof(RandCol));
     
format(stringsizeof(string), "%s hello."RandCol[rand]);
     
SendClientMessage(playerid, -1string);
     return 
1;

now better
Reply
#10

PHP код:
new playerName[MAX_PLAYER_NAME];
new 
slicedName[2][MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
split(playerNameslicedName'_');
printf("Your firstname is %s and your lastname is %s."slicedName[0], slicedName[1]); 
Use slicedName[0] and slicedName[1] for the first name and last name respectively.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)