Help all cmds buged
#1

Help all my cmds in my server are buged help here how i use sscanf
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
  
// 2 LAST CMDS
  
if (strcmp("/restart"cmdtexttrue10) == 0)
    {
        if(
Player[playerid][pAdmin] >= 1)
        {
            
SendClientMessageToAll(COLOR_YELLOW,"[SERVER]:Server is restarting be patient do not quit please");
            
GameTextForAll("~G~Server Restarting"90001);
            
SendRconCommand("gmx");
        }
        else
        {
            
SendClientMessage(playeridCOLOR_RED"[SERVER]:You are not allowed to use this command");
        }
        return 
1;
    }
    if (
strcmp("/desertairport"cmdtexttrue10) == 0)
    {
        if(
Player[playerid][pAdmin] >= 1)
        {
             
SetPlayerPos(playerid,392.2665,2535.1682,16.5429);
             
SendClientMessage(playerid,COLOR_YELLOW,"[SERVER]:You teleported to Desert Airport");
        }
        else
        {
            
SendClientMessage(playeridCOLOR_RED "[SERVER]:You are not allowed to use this command");
        }
        return 
1;
    }
    return 
0;
}
// Is problem at end ??? Also i have no errors
//Ingame when i try to use a cmd it says unknown cmd. 
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
You can't count.
Count ??

I deleted a cmds at end and evrything screwup
Reply
#3

Haven't you checked strcmp parameters?
PHP код:
(const string1[], const string2[], bool:ignorecaselength
There's a parameter called length, which you are not applying properly.
Reply
#4

How to fix it

Do you mean i should script like this ?? got it on wiki

PHP код:

public OnPlayerCommandText(playeridcmdtext[])
{
    if(!
strcmp(cmdtext"/me"true3)) // 3 is the length of /me
    
{
        if(!
cmdtext[3])return SendClientMessage(playerid0xFF0000FF"USAGE: /me [action]");
        new 
str[128];
        
GetPlayerName(playeridstrsizeof(str));
        
format(strsizeof(str), "* %s %s"strcmdtext[4]);
        
SendClientMessageToAll(0xFFFF00AAstr);
        return 
1;
    }
    return 
0;

Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
You can't count.
He's right.

pawn Код:
if (strcmp("/restart", cmdtext, true, 10) == 0)
The 10 represents the number of characters /restart is only 8!

You will need to fix them all for starts.
Reply
#6

Quote:
Originally Posted by Gogeta101
Посмотреть сообщение
How to fix it

Do you mean i should script like this ?? got it on wiki

PHP код:

public OnPlayerCommandText(playeridcmdtext[])
{
    if(!
strcmp(cmdtext"/me"true3)) // 3 is the length of /me
    
{
        if(!
cmdtext[3])return SendClientMessage(playerid0xFF0000FF"USAGE: /me [action]");
        new 
str[128];
        
GetPlayerName(playeridstrsizeof(str));
        
format(strsizeof(str), "* %s %s"strcmdtext[4]);
        
SendClientMessageToAll(0xFFFF00AAstr);
        return 
1;
    }
    return 
0;

Exactly.
Reply
#7

Is there any way to fix them without counting them also if i fix all cmds counting will cmds fix ?
Reply
#8

Fixed counting but cmds still don't work.
Reply
#9

Try conveting to zcmd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)