Help with Screenname. - 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)
+--- Thread: Help with Screenname. (
/showthread.php?tid=292904)
Help with Screenname. -
Azzeto - 25.10.2011
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 i = 500; i < MAX_PLAYERS; i++)
{
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.
Re: Help with Screenname. -
AeroBlast - 25.10.2011
You are trying to write a String into an Intreger.
It should be: INI_WriteString(File,"Screenname",string);
Re: Help with Screenname. -
Azzeto - 25.10.2011
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 i = 0; i < MAX_PLAYERS; i++)
if(PlayerInfo[i][pLaptopon] == 1)
{
format(string,sizeof(string),"[LAPTOP] %s: %s",GetName(playerid),message);
SendClientMessage(i,COLOR_YELLOW,string);
}
return 1;
}
}
Thanks.