SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   Can anyone pass this command from ZCMD to STRCMP? (https://forum.sa-mp.com/showthread.php?t=653863)

leobpo 15/05/2018 04:55 AM

Can anyone pass this command from ZCMD to STRCMP?
 
+Rep
Grateful to help

PHP Code:

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;



GTLS 15/05/2018 07:27 AM

Re: Can anyone pass this command from ZCMD to STRCMP?
 
PHP Code:

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.

Sithis 15/05/2018 09:30 AM

Re: Can anyone pass this command from ZCMD to STRCMP?
 
Quote:

Originally Posted by GTLS (Post 4020065)
PHP Code:

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.

CodeStyle175 15/05/2018 09:32 AM

Re: Can anyone pass this command from ZCMD to STRCMP?
 
why would you even want to do that? strcmp is always slower
PHP Code:

#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;




All times are GMT. The time now is 06:11 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.