Do anyone have?
#1

Do anyone have these commands?

Change nick in server

Change Pass in server
Reply
#2

pawn Код:
if(strcmp(cmd, "/changenick", true) == 0){
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /setname [new nick]");
new
namelen;
namelen = strlen( tmp[idx + 1] );
namelen += ( tmp[idx+1] );
for ( new i = idx+1; i < namelen; i++ ){
if ( isalnum( tmp[i] ) || tmp[i] == '_' || tmp[i] == '[' || tmp[i] == ']' )
continue;
else
return SendClientMessage(playerid,COLOR_RED1,"Name can only have the characters: 0-9, A-Z, a-z, [, ] and _" );
}
if(udb_Exists(tmp)){
SendClientMessage(playerid,COLOR_RED1,"This nick already taken!");
}else{
udb_RenameUser(PlayerName2(playerid),tmp);
SetPlayerName(playerid,tmp);
format(string, sizeof(string),"Nick changed to \"%s\"",tmp);
SendClientMessage(playerid,yellow,string);
}
return 1;
}

stock isalnum(c)
{
  if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) return 1;
  else return 0;
}
Maybe this should work, for /changenick
Reply
#3

Doesn't work, i get error with PLAYERNAME2
Reply
#4

new playername2[MAX_PLAYER_NAME];
Reply
#5

Quote:
Originally Posted by ʎʇʇnןʞ
pawn Код:
if(strcmp(cmd, "/changenick", true) == 0){
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /setname [new nick]");
new
namelen;
namelen = strlen( tmp[idx + 1] );
namelen += ( tmp[idx+1] );
for ( new i = idx+1; i < namelen; i++ ){
if ( isalnum( tmp[i] ) || tmp[i] == '_' || tmp[i] == '[' || tmp[i] == ']' )
continue;
else
return SendClientMessage(playerid,COLOR_RED1,"Name can only have the characters: 0-9, A-Z, a-z, [, ] and _" );
}
if(udb_Exists(tmp)){
SendClientMessage(playerid,COLOR_RED1,"This nick already taken!");
}else{
udb_RenameUser(PlayerName2(playerid),tmp);
SetPlayerName(playerid,tmp);
format(string, sizeof(string),"Nick changed to \"%s\"",tmp);
SendClientMessage(playerid,yellow,string);
}
return 1;
}

stock isalnum(c)
{
  if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) return 1;
  else return 0;
}
Maybe this should work, for /changenick
Lovely indentation.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)