/low won't work? - 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: /low won't work? (
/showthread.php?tid=269193)
/low won't work? [SOLVED/FIXED] -
Gramercy Riffs - 15.07.2011
This is my /low command:
pawn Код:
stock SendClosestMessage( playerid, color, const string[ ] )
{
new
Float: jPos[ 3 ]
;
GetPlayerPos( playerid, jPos[ 0 ], jPos[ 1 ], jPos[ 2 ] );
for ( new j = GetMaxPlayers( ), i; i < j; i ++ )
{
if ( !IsPlayerConnected( i ) )
continue;
if ( IsPlayerInRangeOfPoint( i, 7.0, jPos[ 0 ], jPos[ 1 ], jPos[ 2 ] ) )
{
SendClientMessage( i, color, string );
}
}
return 1;
}
stock RemoveUnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
if ( !strcmp( cmdtext, "/low", true, 3 ) )
{
if ( cmdtext[ 3 ] != ' ' || !cmdtext[ 4 ] )
return SendClientMessage( playerid, -1, "SERVER: /low <text>" );
new
tempString[ 128 ],
pName[ 24 ]
;
GetPlayerName( playerid, pName, sizeof pName );
format( tempString, sizeof tempString, "*%s says [Low]: %s", RemoveUnderScore(playerid), cmdtext[ 3 ] );
SendClosestMessage( playerid, COLOR_WHITE, tempString );
return 1;
}
return 0;
}
Whenever I type just "/low" in-game, it comes up saying: "SERVER: /low <text>" which is perfectly fine. But whenever I add text to the command, say for example: "/low Hello" it will come up with: "SERVER: /low <text>"
Any help, please?
Re: /low won't work? -
CyNiC - 15.07.2011
Try it:
Re: /low won't work? -
Gramercy Riffs - 15.07.2011
Yes! It worked, thanks! But it has one little error:
Whenever I speak IG, it shows up as: Gramercy_Riffs says [Low]:w Hello.
That little "w" was showing up, any ideas?
Re: /low won't work? -
CyNiC - 15.07.2011
Use cmdtext[5] on format instead of cmdtext[3].
See:
pawn Код:
The string "/low" contain 4 chars.
Variable structure: {'/', 'l', 'o', 'w' }
0 1 2 3
Re: /low won't work? -
Gramercy Riffs - 15.07.2011
Thank you.
In that case, would /shout be cmdtext[7]?
Re: /low won't work? -
Gramercy Riffs - 15.07.2011
Fixed! Thank you!