Help with Screenname.
#1

PHP код:
CMD:screenname(playerid,params[]){
    new 
string[128],string1[128],id,name[50];
    if(
PlayerInfo[playerid][pLaptop] == 0) return SendClientMessage(playerid,COLOR_GRAY,"You do not have a laptop!");
    else if(
sscanf(params,"s",name)) return SendClientMessage(playerid,COLOR_GRAY,"Syntax: /Screenname [name]");
    else
    for(new 
500MAX_PLAYERSi++)
    {
        new 
INI:File INI_Open(UserPath(id));
        
format(string,sizeof(string),"%s",name);
        
INI_WriteInt(File,"Screenname",string);
        if(
PlayerInfo[i][pLaptopon] == 1){
        
format(string1,sizeof(string1),"%s has changed their screenname to %s",GetName(playerid),name);
        
SendClientMessage(i,COLOR_YELLOW,string1);
        
INI_Close(File);
        }
    }
    return 
1;

The error I get is with the INI_WriteInt(File,"Screenname",what do I put here?); I had string there but it gave me an error.
Reply
#2

You are trying to write a String into an Intreger.
It should be: INI_WriteString(File,"Screenname",string);
Reply
#3

Oh lol, thanks Repped, (Imma noob with Y_INI still).

EDIT- How would I read from the file to use it on this command?

PHP код:
CMD:laptopmsg(playerid,params[]){
    new 
string[128],message;
    if(
PlayerInfo[playerid][pLaptop] == 0) return SendClientMessage(playerid,COLOR_GRAY,"You do not have a laptop!");
    else if(
sscanf(params,"s",message)) return SendClientMessage(playerid,COLOR_GRAY,"Syntax: /msg [message]");
    else if(
PlayerInfo[playerid][pLaptopon] == 0) return SendClientMessage(playerid,COLOR_GRAY,"Your laptop is not on.");
    else
    {
        for(new 
0MAX_PLAYERSi++)
        if(
PlayerInfo[i][pLaptopon] == 1)
        {
            
format(string,sizeof(string),"[LAPTOP] %s: %s",GetName(playerid),message);
            
SendClientMessage(i,COLOR_YELLOW,string);
        }
        return 
1;
    }
 } 
Thanks.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)