commands with id...
#5

still doesn't work... code:
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(playeridcmdtext[])
{
if(
strcmp(cmd"/freeze"true) == 0// Freezes the player. Prevents him from moving
    
{
        new 
reason[128];
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOUR_ORANGE"USAGE: /freeze [playername/id] [reason]");
                
SendClientMessage(playeridCOLOUR_ORANGE"FUNCTION: Will freeze the specified player.");
                return 
1;
            }
            new 
giveplayerid ReturnUser(tmp);
            if(
giveplayerid != INVALID_PLAYER_ID)
            {
                
GetPlayerName(giveplayeridgiveplayernamesizeof(giveplayername));
                
GetPlayerName(playeridsendernamesizeof(sendername));
                
reason bigstrtok(cmdtextidx);
                if(!
strlen(reason)) return SendClientMessage(playeridCOLOUR_ORANGE"USAGE: /freeze [playername/id] [reason]");
                
format(stringsizeof(string), " Administrator %s froze %s. [Reason: %s ] "sendernamegiveplayernamereason);
                   
SendClientMessageToAll(redstring);
                
TogglePlayerControllable(giveplayeridfalse);
            }
            else if(
giveplayerid == INVALID_PLAYER_ID)
            {
                
format(stringsizeof(string), "%d is not an active player."giveplayerid);
                
SendClientMessage(playeridCOLOUR_REDstring);
            }
            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 >=&& 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 
0MAX_PLAYERSi++)
    {
        if (
IsPlayerConnected(i))
        {
            
GetPlayerName(ipnamesizeof (pname));
            if (
strcmp(pnametext[pos], truelen) == 0)
            {
                if (
len == strlen(pname)) return i;
                else
                {
                    
count++;
                    
userid i;
                }
            }
        }
    }
    if (
count != 1)
    {
        if (
playerid != INVALID_PLAYER_ID)
        {
            if (
countSendClientMessage(playeridYELLOW"There are multiple users, enter full playername.");
            else 
SendClientMessage(playeridRED"Playername not found.");
        }
        
userid INVALID_PLAYER_ID;
    }
    return 
userid;

errors:
PHP код:
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(20) : error 017undefined symbol "cmd"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(25) : warning 217loose indentation
D
:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(25) : error 017undefined symbol "tmp"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(25) : error 017undefined symbol "idx"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(26) : error 017undefined symbol "tmp"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(33) : error 017undefined symbol "tmp"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(36) : error 017undefined symbol "giveplayername"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(36) : error 017undefined symbol "giveplayername"
D:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(36) : error 029invalid expressionassumed zero
D
:\gta san andreas online\Godfucker\filterscripts\AdminCmds.pwn(36) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
9 Errors

Reply


Messages In This Thread
commands with id... - by omer5198 - 13.01.2011, 12:06
Re: commands with id... - by Haydz - 13.01.2011, 12:08
Re: commands with id... - by omer5198 - 13.01.2011, 12:22
Re: commands with id... - by [SU]Balli - 13.01.2011, 12:43
Re: commands with id... - by omer5198 - 13.01.2011, 12:54
Re: commands with id... - by Toreno - 13.01.2011, 13:11
Re: commands with id... - by [SU]Balli - 13.01.2011, 13:52
Re: commands with id... - by omer5198 - 13.01.2011, 15:38
Re: commands with id... - by alpha500delta - 13.01.2011, 15:50
Re: commands with id... - by [SU]Balli - 13.01.2011, 16:13

Forum Jump:


Users browsing this thread: 3 Guest(s)