SA-MP Forums Archive
Do anyone have? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Do anyone have? (/showthread.php?tid=73168)



Do anyone have? - neox - 13.04.2009

Do anyone have these commands?

Change nick in server

Change Pass in server


Re: Do anyone have? - Klutty - 13.04.2009

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


Re: Do anyone have? - neox - 13.04.2009

Doesn't work, i get error with PLAYERNAME2


Re: Do anyone have? - Danut - 13.04.2009

new playername2[MAX_PLAYER_NAME];


Re: Do anyone have? - Pyrokid - 14.04.2009

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.