GameTextForAll - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GameTextForAll (
/showthread.php?tid=179317)
GameTextForAll -
FrankC - 26.09.2010
Why doesnt this command work.. i get no errors when i compile
when i type "/ann text" in-game nothing happends but when i type /ann the
"SYNTAX: /ann [message]" shows so it must be something with the "GameTextForAll"
Код:
command(ann, playerid, params[])
{
new Announcement[128], string[ 128 ];
if( sscanf( params, "z", Announcement) )
{
if( Player[playerid][AdminLevel] >= 1 )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /ann [message]" );
}
}
else
{
if( Player[playerid][AdminLevel] >= 1)
{
if(strlen(Ann) >= 1)
{
format( string, sizeof( string ), " %s ", Announcement );
GameTextForAll( string, 5000, 3 );
}
else
{
SendClientMessage( playerid, WHITE, "SYNTAX: /ann [message]" );
}
}
}
return 1;
}
Re: GameTextForAll -
playbox12 - 26.09.2010
Bad
pawn Код:
if(strlen(Announcement) >= 1)
Good
You are checking the length, of a non existing string, thats why you don't see anything
Also if you are using the sscanf2 plugin, use 's[128]' instead of 'z' Its outdated.
Re: GameTextForAll -
[XST]O_x - 26.09.2010
Plus, you don't need the string, waste of 128 cells
pawn Код:
GameTextForAll( Announcement, 5000, 3 );
Will do exactly the same.
Re: GameTextForAll -
FrankC - 26.09.2010
Quote:
Originally Posted by [XST]O_x
Plus, you don't need the string, waste of 128 cells
pawn Код:
GameTextForAll( Announcement, 5000, 3 );
Will do exactly the same.
|
Quote:
Originally Posted by playbox12
Bad
pawn Код:
if(strlen(Announcement) >= 1)
Good
You are checking the length, of a non existing string, thats why you don't see anything
Also if you are using the sscanf2 plugin, use 's[128]' instead of 'z' Its outdated.
|
Okay well here is my code now:
Код:
command(ann, playerid, params[])
{
new Announcement[128], string[ 128 ];
if( sscanf( params, "z", Announcement) )
{
if( Player[playerid][AdminLevel] >= 1 )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /ann [message]" );
}
}
else
{
if( Player[playerid][AdminLevel] >= 1)
{
if(strlen(Announcement) >= 1)
{
GameTextForAll( string, 5000, 3 );
}
else
{
SendClientMessage( playerid, WHITE, "SYNTAX: /ann [message]" );
}
}
}
return 1;
}
Still not working tryed to add "[128]" if i add that it just keep sending "SYNTAX: /ann [message]"
no matter what you type.. but with "z" no responds at all :/
Re: GameTextForAll -
playbox12 - 26.09.2010
Sigh, please read a bit better, I am quite getting tired so I just fix your code
pawn Код:
command(ann, playerid, params[])
{
new Announcement[128];
if( sscanf( params, "s[128]", Announcement) )
{
if( Player[playerid][AdminLevel] >= 1 )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /ann [message]" );
}
}
else
{
if( Player[playerid][AdminLevel] >= 1)
{
if(strlen(Announcement) >= 1)
{
GameTextForAll(Announcement, 5000, 3 );
}
else
{
SendClientMessage( playerid, WHITE, "SYNTAX: /ann [message]" );
}
}
}
return 1;
}
YES!!
Re: GameTextForAll -
FrankC - 26.09.2010
Quote:
Originally Posted by playbox12
Sigh, please read a bit better, I am quite getting tired so I just fix your code
pawn Код:
command(ann, playerid, params[]) { new Announcement[128]; if( sscanf( params, "s[128]", Announcement) ) { if( Player[playerid][AdminLevel] >= 1 ) { SendClientMessage( playerid, WHITE, "SYNTAX: /ann [message]" ); } } else { if( Player[playerid][AdminLevel] >= 1) { if(strlen(Announcement) >= 1) { GameTextForAll(Announcement, 5000, 3 ); } else { SendClientMessage( playerid, WHITE, "SYNTAX: /ann [message]" ); } } } return 1; }
YES!!
|
Hmm.. Thank you but still not working. if i type "/ann test" it just say "SYNTAX: /ann [message]" as a ClientMessage.
Re: GameTextForAll -
FrankC - 26.09.2010
Okay it works now but now the "SYNTAX /ann [message]" dosnt show
Код:
command(ann, playerid, params[])
{
new Announcement[128];
if( sscanf( params, "s[128]", Announcement) )
{
if( Player[playerid][AdminLevel] >= 1 )
{
GameTextForAll(Announcement, 5000, 3 );
}
}
else
{
if( Player[playerid][AdminLevel] >= 1)
{
if(strlen(Announcement) >= 1)
{
SendClientMessage( playerid, WHITE, "SYNTAX: /ann [message]" );
}
}
}
return 1;
}