Command Doesn't Work
#1

This Command Doesn't work(like all commands like this), I think the reason it because I try to use the command on player, and I do somthing wrong..

The Command:
PHP код:
if(strcmp(cmd,"/MakeHelper",true) == 0)
    {
        if(
IsPlayerAdmin(playerid) || PlayerInfo[playerid][Admin] >= 1338 || PlayerInfo[playerid][Helper] >= 5)
        {
            
tmp = strtok(cmdtext, idx);
            if(!
strlen(tmp))return SendClientMessage(playerid, -1, "USAGE: /MakeHelper [PlayerID] [HelperLevel]");
            
id = ReturnUser(tmp);
            
tmp = strtok(cmdtext, idx);
            new 
level = strval(tmp);
            if(
id == INVALID_PLAYER_ID)return SendClientMessage(playerid, -1, "Invalid Player ID");
            
PlayerInfo[id][Helper] = level;
            
DOF2_SetInt(pFile(id), "Helper", PlayerInfo[id][Helper]);
            
DOF2_SaveFile();
            if(
PlayerInfo[playerid][Admin] >= 1338)
            {
                
format(string, sizeof(string), "Admin %s Give To You Helper Level: %d",sendername, level);
                
SendClientMessage(id, -1, string);
                
format(string, sizeof(string), "Admin %s Give To %s Helper Level: %d",sendername, giveplayer, level);
                
ABroadCast(COLOR_YELLOW, string, 1);
            }
            if(
PlayerInfo[playerid][Helper] >= 5)
            {
                
format(string, sizeof(string), "Helper %s Give To You Helper Level: %d",sendername, level);
                
SendClientMessage(id, -1, string);
                
format(string, sizeof(string), "Helper %s Give To %s Helper Level: %d",sendername, giveplayer, level);
                
HBroadCast(COLOR_YELLOW, string, 1);
            }
        } else { 
DenyMessage(playerid); }
        return 
1;
     } 
The Stocks:
PHP код:
#include <a_samp>
strtok(const string[], &index)
{
    new 
length = strlen(string);
    while ((
index < length) && (string[index] <= ' ')) index++;
    new 
offset = index, result[20];
    while ((
index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        
result[index - offset] = string[index];
        
index++;
    }
    
result[index - offset] = EOS;
    return 
result;
}
stock ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
    new 
pos = 0;
    while (
text[pos] < 0x21) // Strip out leading spaces
    
{
        if (
text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
        
pos++;
    }
    new 
userid = INVALID_PLAYER_ID;
    if (
IsNumeric(text[pos])) // Check whole passed string
    
{
        
// If they have a numeric name you have a problem (although names are checked on id failure)
        
userid = strval(text[pos]);
        if (
userid >=0 && userid < MAX_PLAYERS)
        {
            if(!
IsPlayerConnected(userid))
            {
                
userid = INVALID_PLAYER_ID;
            }
            else
            {
                return 
userid; // A player was found
            
}
        }
    }
    
// They entered [part of] a name or the id search failed (check names just incase)
    
new len = strlen(text[pos]);
    new 
count = 0;
    new 
name[MAX_PLAYER_NAME];
    for (new 
i = 0; i < MAX_PLAYERS; i++)
    {
        if (
IsPlayerConnected(i))
        {
            
GetPlayerName(i, name, sizeof (name));
            if (
strcmp(name, text[pos], true, len) == 0) // Check segment of name
            
{
                if (
len == strlen(name)) // Exact match
                
{
                    return 
i; // Return the exact player on an exact match
                
}
                else 
// Partial match
                
{
                    
count++;
                    
userid = i;
                }
            }
        }
    }
    if (
count != 1)
    {
        if (
playerid != INVALID_PLAYER_ID)
        {
            if (
count)
            {
                
SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow search.");
            }
            else
            {
                
SendClientMessage(playerid, 0xFF0000AA, "No matching user found.");
            }
        }
        
userid = INVALID_PLAYER_ID;
    }
    return 
userid; // INVALID_PLAYER_ID for bad return
}
IsNumeric(const string[])
{
    for (new 
i = 0, j = strlen(string); i < j; i++)
    {
        if (
string[i] > '9' || string[i] < '0') return 0;
    }
    return 
1;
}
stock strrest(const string[],index)
{
    new 
length = strlen(string),offset = index,result[256];
    while((
index < length) && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r')) result[index - offset] = string[index],index++;
    
result[index - offset] = EOS;
    if(
result[0] == ' ' && string[0] != ' ') strdel(result,0,1);
    return 
result;
} 
What The Problem Please Help Me ..
Reply
#2

Any errors or warnings while compiling ? and what does it show when you type the command ?
Reply
#3

Quote:
Originally Posted by Red_Dragon.
Посмотреть сообщение
Any errors or warnings while compiling ? and what does it show when you type the command ?
Have Not Any warning or errors, when im type the commands nothing happens
Reply
#4

Is the player your making other helpers with (you) an admin of level 1338 ?
Reply
#5

Quote:
Originally Posted by Red_Dragon.
Посмотреть сообщение
Is the player your making other helpers with (you) an admin of level 1338 ?
Im Connecting To The RCON
PHP код:
if(IsPlayerAdmin(playerid) 
Reply
#6

Try to make yourself admin in the USER file in SCRIPTFILES i do not think RCON works on that Commands
Reply
#7

Im try this it doesn't work but im discoverd no one of my commands in the filterscript worked, I dont know why like simple command :
PHP код:
if(strcmp(cmdtext,"/AdminMe",true) == 0)
    {
        
PlayerInfo[playerid][Admin] = 5000;
        
DOF2_SetInt(pFile(playerid), "Admin", PlayerInfo[playerid][Admin]);
        return 
1;
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)