SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/05/2018, 04:55 AM   #1
leobpo
Big Clucker
 
Join Date: Dec 2016
Location: Itapevi SP
Posts: 60
Reputation: 0
Default 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;

__________________
leobpo is offline   Reply With Quote
Old 15/05/2018, 07:27 AM   #2
GTLS
High-roller
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: India
Posts: 1,044
Reputation: 115
Default 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.
__________________

I don't help for rep. I help cuz I was helped in the past.


Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote
Old 15/05/2018, 09:30 AM   #3
Sithis
Gangsta
 
Join Date: Mar 2013
Location: the Netherlands
Posts: 887
Reputation: 79
Default Re: Can anyone pass this command from ZCMD to STRCMP?

Quote:
Originally Posted by GTLS View Post
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.
__________________
Developer and owner of https://trinityrpg.com
Sithis is offline   Reply With Quote
Old 15/05/2018, 09:32 AM   #4
CodeStyle175
Banned
 
Join Date: Apr 2014
Posts: 455
Reputation: 35
Default 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;


Last edited by CodeStyle175; 19/05/2018 at 05:12 PM.
CodeStyle175 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting strcmp command to zcmd MrTinder Scripting Help 3 02/04/2013 12:33 PM
command from zcmd to strcmp toi Scripting Help 4 23/02/2013 11:38 AM
Need help converting a strcmp to zcmd command EAsT-OAK_510 Scripting Help 5 19/12/2012 08:24 AM
Converting strcmp command to ZCMD JiMadness Scripting Help 6 11/09/2011 01:20 PM
Name somehow seems to pass !strcmp while not the same Jochemd Help Archive 5 09/05/2011 07:25 PM


All times are GMT. The time now is 02:15 PM.


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