Problem command /ann
#3

I'm not sure why you're even restricting the use of '~f~' and '~o~'... they're not even valid gametext keys.
https://sampwiki.blast.hk/wiki/GameTextStyle

Quote:

Be careful, using too many text colors or special characters in one gametext may crash every player the gametext is shown to. Additionally, avoid using an uneven usage of the ~ character.
Example: ~~r~Hello, ~g~how are ~y~~you?~

PHP код:
CMD:ann(playeridparams[])
{
    if(
isnull(params)) // If the player did not enter parameters...
        
return SendClientMessage(playerid, -1"Usage: /ann [text]"); // Send the player a usage message.
    
if(strfind(params"~k~"true) != -1// If we find a forbidden string in our text...
        
return SendClientMessage(playerid, -1"Wrong!"); // Send the player an error message.

    
new count 0// Store the count of tildes (~) in this variable.
    
for(new 0strlen(params); ji++) // Loop through the string to count all the tildes (~).
    
{
        if(
params[i] == '~'// If the character is a tilde...
            
count++; // Add 1 to our count.
    
}

    if((
count 2) != 0// If the number of tildes in our message is odd...
        
return SendClientMessage(playerid, -1"Odd number of tildes!"); // Send an error message to the player.

    
GameTextForAll(params100004); // Send the game text to all players.
    
return 1;

This basic command only stops the admin/player using '~k~' in the message as well as having unmatched tildes.
Reply


Messages In This Thread
Problem command /ann - by KamilPolska - 31.12.2018, 03:47
Re: Problem command /ann - by GeorgeLimit - 31.12.2018, 05:33
Re: Problem command /ann - by Threshold - 31.12.2018, 06:25

Forum Jump:


Users browsing this thread: 1 Guest(s)