SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 27/07/2013, 01:47 PM   #1
Anak
Gangsta
 
Anak's Avatar
 
Join Date: Jul 2012
Location: Pakistan
Posts: 819
Reputation: 45
Default Case sensitive user names.

hello i want my login system to convert all nicks to lower case .. i mean if a player nick: TeST.. the file must be saved as test.ini..


P.S: edit my code..

here is code:

pawn Code:
stock Path(playerid) //Will create a new stock so we can easily use it later to load/save user's data in user's path
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(str,sizeof(str),UserPath, name);
    return str;
}
__________________
мы любим Вас Путина !! мы лучшие!
Anak is offline   Reply With Quote
Old 27/07/2013, 01:48 PM   #2
Donvalley
Huge Clucker
 
Donvalley's Avatar
 
Join Date: Jul 2007
Location: Australia
Posts: 411
Reputation: 26
Default Re: Case sensitive user names.

they answered this for you already?

http://forum.sa-mp.com/showthread.ph...hlight=tolower

by using:

http://wiki.sa-mp.com/wiki/Tolower
__________________


I am not a Master Scripter. But if you have a problem i will happily try my best to help, so if a bit of code i wrote doesn't work you don't have to-Rep me for it. I am trying my best to help you.
Donvalley is offline   Reply With Quote
Old 27/07/2013, 01:51 PM   #3
JimmyCh
Gangsta
 
JimmyCh's Avatar
 
Join Date: Mar 2013
Location: LB
Posts: 656
Reputation: 62
Default Re: Case sensitive user names.

EDIT: Nevermind, too late.
__________________

Left SA-MP, you can always find me on Steam playing CS:GO though
http://steamcommunity.com/profiles/76561198173703259/ OR
http://steamcommunity.com/id/grizzlyjim/
Skype: jimmycherfan
JimmyCh is offline   Reply With Quote
Old 27/07/2013, 02:02 PM   #4
Anak
Gangsta
 
Anak's Avatar
 
Join Date: Jul 2012
Location: Pakistan
Posts: 819
Reputation: 45
Default Re: Case sensitive user names.

ok so like this?

pawn Code:
public NickToLower(const nick[])
{
    for(new i=0, j=strlen(nick); i<j; i++)
    {
        nick[i] = tolower(nick[i]);
    }
    return nick;
}
forward NickToLower(nick[]);
stock Path(playerid) //Will create a new stock so we can easily use it later to load/save user's data in user's path
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(str,sizeof(str),UserPath, NickToLower[name]);
    return str;
}


then i get these errors:
Code:
D:\1v1_Nouman_server\filterscripts\project.pwn(1675) : error 022: must be lvalue (non-constant)
D:\1v1_Nouman_server\filterscripts\project.pwn(1677) : error 090: public functions may not return arrays (symbol "NickToLower")
D:\1v1_Nouman_server\filterscripts\project.pwn(1679) : error 025: function heading differs from prototype
D:\1v1_Nouman_server\filterscripts\project.pwn(1684) : error 028: invalid subscript (not an array or too many subscripts): "NickToLower"
D:\1v1_Nouman_server\filterscripts\project.pwn(1684) : warning 215: expression has no effect
D:\1v1_Nouman_server\filterscripts\project.pwn(1684) : error 001: expected token: ";", but found "]"
D:\1v1_Nouman_server\filterscripts\project.pwn(1684) : error 029: invalid expression, assumed zero
D:\1v1_Nouman_server\filterscripts\project.pwn(1684) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


7 Errors.
__________________
мы любим Вас Путина !! мы лучшие!
Anak is offline   Reply With Quote
Old 27/07/2013, 02:13 PM   #5
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 2,831
Reputation: 668
Default AW: Case sensitive user names.

like this NickToLower(name)
Nero_3D is offline   Reply With Quote
Old 27/07/2013, 03:49 PM   #6
Anak
Gangsta
 
Anak's Avatar
 
Join Date: Jul 2012
Location: Pakistan
Posts: 819
Reputation: 45
Default Re: Case sensitive user names.

hello...

this code:

pawn Code:
public NickToLower(const nick[])
{
    for(new i=0, j=strlen(nick); i<j; i++)
    {
        nick[i] = tolower(nick[i]); // 1675
    }
    return nick;// 1677
}
forward NickToLower(nick[]); // 1679
stock Path(playerid) //Will create a new stock so we can easily use it later to load/save user's data in user's path
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(str,sizeof(str),UserPath, NickToLower(name));
    return str;
}


and now errors

Code:
D:\1v1_Nouman_server\filterscripts\project.pwn(1675) : error 022: must be lvalue (non-constant)
D:\1v1_Nouman_server\filterscripts\project.pwn(1677) : error 090: public functions may not return arrays (symbol "NickToLower")
D:\1v1_Nouman_server\filterscripts\project.pwn(1679) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
__________________
мы любим Вас Путина !! мы лучшие!
Anak is offline   Reply With Quote
Old 27/07/2013, 03:56 PM   #7
QuaTTrO
Gangsta
 
QuaTTrO's Avatar
 
Join Date: Aug 2009
Posts: 516
Reputation: 75
Default Re: Case sensitive user names.

pawn Code:
stock NickToLower(const nick[])
{
    for(new i=0, j=strlen(nick); i<j; i++)
    {
        nick[i] = tolower(nick[i]);
    }
    return nick;
}

stock Path(playerid) //Will create a new stock so we can easily use it later to load/save user's data in user's path
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(str,sizeof(str),UserPath, NickToLower(name));
    return str;
}

Don't use public to create functions.
QuaTTrO is offline   Reply With Quote
Old 27/07/2013, 04:04 PM   #8
Anak
Gangsta
 
Anak's Avatar
 
Join Date: Jul 2012
Location: Pakistan
Posts: 819
Reputation: 45
Default Re: Case sensitive user names.

now i get this error:

Code:
D:\1v1_Nouman_server\filterscripts\project.pwn(1675) : error 022: must be lvalue (non-constant)
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
on this line

pawn Code:
nick[i] = tolower(nick[i]);
__________________
мы любим Вас Путина !! мы лучшие!
Anak is offline   Reply With Quote
Old 27/07/2013, 04:19 PM   #9
QuaTTrO
Gangsta
 
QuaTTrO's Avatar
 
Join Date: Aug 2009
Posts: 516
Reputation: 75
Default Re: Case sensitive user names.

My bad i didn't notice const. This should look like this
pawn Code:
stock NickToLower(nick[]) //Just remove const
{
    for(new i=0, j=strlen(nick); i<j; i++)
    {
        nick[i] = tolower(nick[i]);
    }
    return nick;
}
QuaTTrO is offline   Reply With Quote
Old 27/07/2013, 04:26 PM   #10
Anak
Gangsta
 
Anak's Avatar
 
Join Date: Jul 2012
Location: Pakistan
Posts: 819
Reputation: 45
Default Re: Case sensitive user names.

ok now .. if i use test name CRAZYBoB.. it should be converted to "crazybob.ini" (in script files) but i got
",€(¼crazybob.ini" (inside script files instead of "crazybob.ini")
__________________
мы любим Вас Путина !! мы лучшие!
Anak is offline   Reply With Quote
Reply

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
[ini] Case sensitive problem. Kebab- Scripting Help 6 06/01/2013 01:20 PM
MySQL - PlayerName - Case sensitive nGen.SoNNy Scripting Help 2 12/11/2012 07:50 PM
[REP+] Dialog problem, case 1 causing errors, case 2 and 3 works fine, cant find problem niels44 Scripting Help 0 21/04/2012 07:44 PM
How to make this query non-case sensitive? Lorenc_ Scripting Help 2 02/01/2012 10:05 PM
[Map] >Sensitive's City< [BIG PROJECT] Sensitive Maps 9 23/04/2011 08:13 PM


All times are GMT. The time now is 02:37 AM.


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