little help - 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: little help (
/showthread.php?tid=605612)
little help -
GeneralAref - 22.04.2016
hi guys.this code for my clan news but i have one problem.
update code:
Код:
stock UpdateClanNews(playerid,text[]){
if(strlen(text)>1024)return SendClientMessage(playerid,COLOR_RED,"Only 1024 characters for the clan's news allowed.");
new str[256],str2[256],nfile[256];
GetPVarString(playerid,"Clanname",str,sizeof(str));
format(nfile,sizeof(nfile),ClanNewsFile,str);
dini_Remove(nfile);
dini_Create(nfile);
new File:file=fopen(nfile,io_append);
fwrite(file,text);
fclose(file);
foreach(Player,i){
GetPVarString(i,"Clanname",str2,sizeof(str2));
if(!strcmp(str,str2))SendClientMessage(i,COLOR_DARKOLIVEGREEN,"You're clan's news has updated.");}
return 1;}
see code:
Код:
CMD:cnews(playerid,params[]){
#define usused params
new nfile[256],string[256],handle[1024],str[256],str2[258];
if(!CheckCommandState("cnews"))return SendClientMessage(playerid,COLOR_RED,"This command is disabled.");
if(!CheckCommandPerm(playerid,0))return SendClientMessage(playerid,COLOR_RED,"You are not authorized to use this command.");
if(!GetPVarInt(playerid,"Clan"))return SendClientMessage(playerid,COLOR_RED,"You are not in any clan.");
GetPVarString(playerid,"Clanname",string,sizeof(string));
format(nfile,sizeof(nfile),ClanNewsFile,string);
new File:file=fopen(nfile,io_read);
while(fread(file,str)){
format(str2,sizeof(str2),"%s\n",str);
strcat(handle,str2);}
fclose(file);
ShowPlayerDialog(playerid,ClanNewsDialog,DIALOG_STYLE_MSGBOX,""#COL_GREEN"Your Clan News",handle,"Ok","");
return 1;}
im enter hehehehehehe\r in dialog but when im type /cnews:
Re: little help -
Saliim - 22.04.2016
hi,
Hi, trying to remove the "\n" because I think it bears confusion with the "%s"
try to add the "\n" is the place where you have to add the "hehehehehe"
You can see that :
How To Create a Dialog
Re: little help -
GeneralAref - 22.04.2016
Does not work.