13.01.2011, 12:54
still doesn't work... code:
errors:
PHP код:
#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define COLOUR_GREEN 0x33AA33AA
#define COLOUR_RED 0xAA3333AA
#define COLOUR_YELLOW 0xFFFF00AA
#define COLOUR_LIGHTBLUE 0x33CCFFAA
#define COLOUR_ORANGE 0xFF9900AA
public OnFilterScriptInit()
{
print("\n****************************************");
print("* AdminCmds *");
print("****************************************\n");
return 1;
}
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/freeze", true) == 0) // Freezes the player. Prevents him from moving
{
new reason[128];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /freeze [playername/id] [reason]");
SendClientMessage(playerid, COLOUR_ORANGE, "FUNCTION: Will freeze the specified player.");
return 1;
}
new giveplayerid = ReturnUser(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
reason = bigstrtok(cmdtext, idx);
if(!strlen(reason)) return SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /freeze [playername/id] [reason]");
format(string, sizeof(string), " Administrator %s froze %s. [Reason: %s ] ", sendername, giveplayername, reason);
SendClientMessageToAll(red, string);
TogglePlayerControllable(giveplayerid, false);
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOUR_RED, string);
}
return 1;
}
return 0;
}
stock strtok(const string[], &idx)
{
new length = strlen(string);
while ((idx < length) && (string[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = string[idx];
idx++;
}
result[idx - offset] = EOS;
return result;
}
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
new pos = 0;
while (text[pos] < 0x21)
{
if (text[pos] == 0) return INVALID_PLAYER_ID;
pos++;
}
new userid = INVALID_PLAYER_ID;
if (IsNumeric(text[pos]))
{
userid = strval(text[pos]);
if (userid >=0 && userid < MAX_PLAYERS)
{
if(!IsPlayerConnected(userid))
userid = INVALID_PLAYER_ID;
else return userid;
}
}
new len = strlen(text[pos]);
new count = 0;
new pname[MAX_PLAYER_NAME];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, pname, sizeof (pname));
if (strcmp(pname, text[pos], true, len) == 0)
{
if (len == strlen(pname)) return i;
else
{
count++;
userid = i;
}
}
}
}
if (count != 1)
{
if (playerid != INVALID_PLAYER_ID)
{
if (count) SendClientMessage(playerid, YELLOW, "There are multiple users, enter full playername.");
else SendClientMessage(playerid, RED, "Playername not found.");
}
userid = INVALID_PLAYER_ID;
}
return userid;
}
PHP код:
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(20) : error 017: undefined symbol "cmd"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(25) : warning 217: loose indentation
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(25) : error 017: undefined symbol "tmp"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(25) : error 017: undefined symbol "idx"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(26) : error 017: undefined symbol "tmp"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(33) : error 017: undefined symbol "tmp"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(36) : error 017: undefined symbol "giveplayername"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(36) : error 017: undefined symbol "giveplayername"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(36) : error 029: invalid expression, assumed zero
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(36) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
9 Errors.