write_pawn_script
Writes and edits Pawn .pwn/.inc files for SA-MP projects with proper encoding, replacing single lines or ranges to avoid file corruption.
Instructions
MANDATORY: ALWAYS use this for .pwn/.inc files. It is the ONLY safe way to handle encoding and language. Standard tools WILL corrupt files. CRITICAL: When replacing a line range, ALWAYS provide BOTH startLine AND endLine. Providing only startLine replaces only that single line.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the file | |
| content | Yes | Content to write | |
| endLine | No | Last line to replace (1-indexed). MUST be >= startLine. Omitting this with startLine set replaces ONLY that single line, NOT to end of file. | |
| encoding | No | Override encoding (defaults to project's auto-detected encoding) | |
| startLine | No | First line to replace (1-indexed). Omit to overwrite the entire file. |