SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 01/03/2010, 03:07 PM   #1
BuLLeT[LTU]
Big Clucker
 
BuLLeT[LTU]'s Avatar
 
Join Date: May 2008
Location: Lithuania
Posts: 155
Reputation: 7
Default Changenick bug

Hello. I need help with this. My nick name in game is [_FFG_]BuLLeT and i try to change nick to [_FFG_]BuLLet (with t small) and then my nick isn't changed, but my file account is changed to [_FFG_]BuLLet and i lose statistic. How to fix it?

pawn Code:
dcmd_changenick( playerid, params[ ] ){
if ( params[ 0 ] == '\0' ) return ChangenickUsage(playerid);
new
tName[ MAX_PLAYER_NAME ],
idx;
tName = strtok4(params, idx );
if ( IsNumeric( tName ) ){
new
nameid  = strval( tName ),
namelen = strlen( params[ idx + 1 ] );
if ( !IsPlayerConnected( nameid ) )
return WrongID(playerid);
if(nameid < 0) return WrongID(playerid);
GetPlayerName( nameid, tName, MAX_PLAYER_NAME );
new otherplayer = ReturnUser(tName);
if(otherplayer != playerid) return OnlyYourNick(playerid);
if ( !namelen )
return ChangenickUsage(playerid);
if ( namelen < 3 || namelen > 20 )
return NameLengh(playerid);
namelen += ( idx + 1 );
for (new i = idx + 1; i < namelen; i++ ){
if ( isalnum( params[ i ] ) || params[ i ] == '_' || params[ i ] == '[' || params[ i ] == ']' )
continue;
else
return Characters(playerid);
}
if(dini_Exists(params[ idx + 1 ])) return SendClientMessage(playerid,COLOR_GRAD1,"*[INFO]: Šis vartotojo vardas jau naudojamas!");
if(udb_Exists(params[ idx + 1 ])){
SendClientMessage(playerid,COLOR_GRAD1,"*[INFO]: Šis vartotojo vardas jau naudojamas!");
}else{
if(dini_Int(accountfile(playerid),"HasCar") == 1){
dini_Set(carfile(dini_Int(accountfile(playerid),"BCar")), "Owner",params[ idx + 1 ]);
}
for(new i=0;i<MAX_HOUSES;i++){
if(strcmp(dini_Get(housefile(i), "Owner"), PlayerName2(playerid), true) == 0){
dini_Set(housecarfile(i), "Owner",params[ idx + 1 ]);
dini_Set(housefile(i), "Owner", params[ idx + 1 ]);
}
}
new nameaa[MAX_PLAYER_NAME];
GetPlayerName(playerid, nameaa, MAX_PLAYER_NAME);
for(new propid; propid < PropertiesAmount; propid++){
if(PropInfo[propid][PropIsBought] == 1){
if(strcmp(PropInfo[propid][PropOwner], nameaa, true)==0){
format(PropInfo[propid][PropOwner], MAX_PLAYER_NAME, params[ idx + 1 ]);
}
}
}
new oldfname3[MAX_STRING];
new newfname3[MAX_STRING];
format(oldfname3,sizeof(oldfname3),"AccountPasswords/%s.dudb.sav",PlayerName2(playerid));
format(newfname3,sizeof(newfname3),"AccountPasswords/%s.dudb.sav",params[ idx + 1 ]);
frenametextfile(oldfname3,newfname3);
format(bstring2,256,"/VIP/%s.txt",PlayerName2(playerid));
if(!dini_Exists(bstring2))
{dini_Create(bstring2);}
new oldfname2[MAX_STRING];
new newfname2[MAX_STRING];
format(oldfname2,sizeof(oldfname2),"VIP/%s.txt",PlayerName2(playerid));
format(newfname2,sizeof(newfname2),"VIP/%s.txt",params[ idx + 1 ]);
frenametextfile(oldfname2,newfname2);
new oldfname[MAX_STRING];
new newfname[MAX_STRING];
format(oldfname,sizeof(oldfname),"Accounts/%s.txt",PlayerName2(playerid));
format(newfname,sizeof(newfname),"Accounts/%s.txt",params[ idx + 1 ]);
frenametextfile(oldfname,newfname);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
new string[256]; format(string, sizeof(string),"*[INFO]: Vartotojo vardas pakeistas į \"%s\"",params[ idx + 1 ]);
SendClientMessage(playerid,COLOR_GRAD1,string);
SetPlayerName(playerid,params[ idx + 1 ]);
}
}
return 1;
}
__________________

BuLLeT[LTU] is offline  
Old 01/03/2010, 03:15 PM   #2
bajskorv123
Huge Clucker
 
Join Date: Sep 2009
Posts: 405
Reputation: 0
Default Re: Changenick bug

Quote:
Originally Posted by Teh Wiki >_>
Important Note: If you set the player's name to the same name, expect different case latters (ie "heLLO" to "hello") it will not work.
bajskorv123 is offline  
Old 01/03/2010, 03:17 PM   #3
BuLLeT[LTU]
Big Clucker
 
BuLLeT[LTU]'s Avatar
 
Join Date: May 2008
Location: Lithuania
Posts: 155
Reputation: 7
Default Re: Changenick bug

How to do that player cant change nick if it is same but not words?
__________________

BuLLeT[LTU] is offline  
Old 01/03/2010, 03:19 PM   #4
bajskorv123
Huge Clucker
 
Join Date: Sep 2009
Posts: 405
Reputation: 0
Default Re: Changenick bug

Use the check:
pawn Code:
if(strval(params) == tName)
Then return 0 or something...
bajskorv123 is offline  
Old 01/03/2010, 03:22 PM   #5
BuLLeT[LTU]
Big Clucker
 
BuLLeT[LTU]'s Avatar
 
Join Date: May 2008
Location: Lithuania
Posts: 155
Reputation: 7
Default Re: Changenick bug

it is writting that tName must be indexed..
__________________

BuLLeT[LTU] is offline  
Old 01/03/2010, 03:37 PM   #6
Sergei
High-roller
 
Sergei's Avatar
 
Join Date: Mar 2008
Location: Slovenia
Posts: 2,862
Reputation: 230
Default Re: Changenick bug

You couldn't complicate moe with your command? That command could be a few lines long ...

First set name with SetPlayerName and depending on result (if it returns 0) don't change file names.
Quote:
Returns 1 if the name was changed, 0 if the player is already using that name or -1 when the name cannot be changed (it's in use, too long or has invalid characters)
__________________
Watch out, scouts everywhere!
Sergei is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
changenick help BuLLeT[LTU] Help Archive 1 05/03/2010 01:47 PM
changenick _ReloadeD_ Help Archive 1 06/10/2009 02:47 PM
/changenick command! breakpaper Help Archive 3 16/07/2009 01:28 PM


All times are GMT. The time now is 12:06 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.