Can anyone pass this command from ZCMD to STRCMP?
#1

+Rep
Grateful to help

PHP код:
CMD:darcash(playeridparams[])
{
    if(
JogadorInfo[playerid][pAdmin] < 1342 || IsPlayerAdmin(playerid)) return SendClientMessage(playeridiCor_Chat"Vocк nгo й Administrador Dono");
    if(
sscanf(params"dd"iIdSmiriTotalCash)) return SendClientMessage(playeridiCor_Chat"USO: /darcash [ID] [Quantidade]");
    if(!
IsPlayerConnected(iIdSmir)) return SendClientMessage(playeridiCor_Chat"ID Nгo Conectado");
    
GetPlayerName(playeridNomesizeof(Nome));
    
GetPlayerName(iIdSmirNome2sizeof(Nome2));
    
format(iCelulassizeof(iCelulas), "[ iShoppinG ]: %s Deu %d Cash's Para o Jogador %s"NomeiTotalCashNome2);
    
SmirnoffReceberMensagens(COLOR_YELLOW,iCelulas,1);
    
format(iCelulassizeof(iCelulas), "Vocк Recebeu [%d] de Cash do Administrador [%s]"iTotalCashNome);
    
SendClientMessage(iIdSmirCOLOR_LIGHTBLUEiCelulas);
    
JogadorInfo[playerid][pCoins] += iTotalCash;
    
AtualizarCash(iIdSmir);
    return 
1;

Reply
#2

PHP код:
if(!strcmp(cmd"/darcash"true)) //Under OnPlayerCommandText

    if(
JogadorInfo[playerid][pAdmin] < 1342 || IsPlayerAdmin(playerid)) return SendClientMessage(playeridiCor_Chat"Vocк nгo й Administrador Dono"); 
    if(
sscanf(params"dd"iIdSmiriTotalCash)) return SendClientMessage(playeridiCor_Chat"USO: /darcash [ID] [Quantidade]"); 
    if(!
IsPlayerConnected(iIdSmir)) return SendClientMessage(playeridiCor_Chat"ID Nгo Conectado"); 
    
GetPlayerName(playeridNomesizeof(Nome)); 
    
GetPlayerName(iIdSmirNome2sizeof(Nome2)); 
    
format(iCelulassizeof(iCelulas), "[ iShoppinG ]: %s Deu %d Cash's Para o Jogador %s"NomeiTotalCashNome2); 
    
SmirnoffReceberMensagens(COLOR_YELLOW,iCelulas,1); 
    
format(iCelulassizeof(iCelulas), "Vocк Recebeu [%d] de Cash do Administrador [%s]"iTotalCashNome); 
    
SendClientMessage(iIdSmirCOLOR_LIGHTBLUEiCelulas); 
    
JogadorInfo[playerid][pCoins] += iTotalCash
    
AtualizarCash(iIdSmir); 
    return 
1

It was literally one line change... and refrain from saying you'll +rep for help cuz people tend not to help sometimes.
Reply
#3

Quote:
Originally Posted by GTLS
Посмотреть сообщение
PHP код:
if(!strcmp(cmd"/darcash"true)) //Under OnPlayerCommandText

    if(
JogadorInfo[playerid][pAdmin] < 1342 || IsPlayerAdmin(playerid)) return SendClientMessage(playeridiCor_Chat"Vocк nгo й Administrador Dono"); 
    if(
sscanf(params"dd"iIdSmiriTotalCash)) return SendClientMessage(playeridiCor_Chat"USO: /darcash [ID] [Quantidade]"); 
    if(!
IsPlayerConnected(iIdSmir)) return SendClientMessage(playeridiCor_Chat"ID Nгo Conectado"); 
    
GetPlayerName(playeridNomesizeof(Nome)); 
    
GetPlayerName(iIdSmirNome2sizeof(Nome2)); 
    
format(iCelulassizeof(iCelulas), "[ iShoppinG ]: %s Deu %d Cash's Para o Jogador %s"NomeiTotalCashNome2); 
    
SmirnoffReceberMensagens(COLOR_YELLOW,iCelulas,1); 
    
format(iCelulassizeof(iCelulas), "Vocк Recebeu [%d] de Cash do Administrador [%s]"iTotalCashNome); 
    
SendClientMessage(iIdSmirCOLOR_LIGHTBLUEiCelulas); 
    
JogadorInfo[playerid][pCoins] += iTotalCash
    
AtualizarCash(iIdSmir); 
    return 
1

It was literally one line change... and refrain from saying you'll +rep for help cuz people tend not to help sometimes.
This will not work, since you did not extract any of the command parameters.

To OP: Why even convert to strcmp? It's old, slow and there are much better command processors available, such as ZCMD.
Reply
#4

why would you even want to do that? strcmp is always slower
PHP код:
#include <a_samp>
#include <sscanf2>
uname(pid){
    new 
s[24];
    
GetPlayerName(pid,s,24);
    return 
s;
}
#define scm SendClientMessage
public OnPlayerCommandText(playeridcmdtext[]){
    new 
pid=playerid,cmd[30],p[128],s[128];
    
sscanf(cmdtext"s[30]s[128]"cmdp);
    if(!
strcmp(cmd,"/darcash"true)){
        new 
idamount;
        if(
JogadorInfo[pid][pAdmin] < 1342 && !IsPlayerAdmin(pid)) return scm(pidiCor_Chat"Vocк nгo й Administrador Dono"); 
        if(
sscanf(p,"dd",idamount)) return scm(pidiCor_Chat"USO: /darcash [ID] [Quantidade]"); 
        if(!
IsPlayerConnected(id)) return scm(pidiCor_Chat"ID Nгo Conectado"); 
        
        
format(ssizeof(s), "[ iShoppinG ]: %s Deu %d Cash's Para o Jogador %s"uname(pid), amountuname(id)); 
        
SmirnoffReceberMensagens(COLOR_YELLOW,s,1); 
        
        
format(ssizeof(s), "Vocк Recebeu [%d] de Cash do Administrador [%s]"amountNome); 
        
scm(idCOLOR_LIGHTBLUEs); 
        
        
JogadorInfo[pid][pCoins] += amount
        
AtualizarCash(id);     
    }
    return 
0;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)