[Tutorial] Bad scripting habits - What not to do in a script
#4

It looks good, but there is a fail:
Quote:

\scriptfiles\Accounts\%s.ini

You did do new Path[25];. The length of the string is 28. That is one fail. + Playername length, which is 24. So it should be 28+MAX_PLAYER_NAME, which equals to 28+24, which equals to 52. So the Path should be 52 instead of 25 (lol). With what you now have, the string would be:
\scriptfiles\Accounts\Kwa (if my name was "Kwarde" in the game).
And about the switches: It could be a good idea, if you tell about the comma too, and the 'default' (some people don't know it doest exists)
pawn Code:
switch(random(50))
{
    case 1..11,15: SendRconCommand("say Something [1]"); //So, 1,2,3,4,5,6,7,8,9,10,11 or 15
    case 16,17,19: SendRconCommand("say Something [2]"); //So, 16,17 and 19
    default: SendRconCommand("say Something [3]"); //When it's none of above
}
But your tutorial is nice though, well explained etc.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)