SA-MP Forums Archive
[Ajuda] /darmaconha e /darcocaina - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] /darmaconha e /darcocaina (/showthread.php?tid=377895)



/darmaconha e /darcocaina - maluco88 - 15.09.2012

Tipow eu queria um comando que que tem abaixo sу pra basear aqui embaixo:

maconha:
pawn Код:
if(GetPlayerMoney(playerid) >= 8000)
{
Maconha[playerid] += 80;
GetPlayerName(playerid, sendername, sizeof(sendername));
dini_IntSet(udb_encode(sendername), "Maconha", Maconha[playerid]);
GivePlayerMoney(playerid, -8000);
SendClientMessage(playerid, 0x33AAFFFF, "Vocк comprou pacote de 80 de maconha, para usar: /usarmaconha");
}
cocaina:
pawn Код:
if(GetPlayerMoney(playerid) >= 2000)
{
Cocaina[playerid] += 10;
GetPlayerName(playerid, sendername, sizeof(sendername));
dini_IntSet(udb_encode(sendername), "Cocaina", Cocaina[playerid]);
GivePlayerMoney(playerid, -2000);
SendClientMessage(playerid, 0x33AAFFFF, "Vocк comprou 10 de pу, para usar: /usarcocaina");

}



Re: /darmaconha e /darcocaina - Rhayziin - 15.09.2012

pawn Код:
#include <a_samp>
#define FILTERSCRIPT
#include <zcmd>
#include <sscanf>

new Maconha[MAX_PLAYERS];
new Cocaina[MAX_PLAYERS];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Dar cocaina e maconha [Rhay_Fither]");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

CMD:darcocaina(playerid, params[])
{
    new zID, zQuantia, zString[128], zNome[MAX_PLAYER_NAME];
    if(sscanf(params, "ud", zID, zQuantia)) return SendClientMessage(playerid, -1, "USE: /darcocaina [ID] [QUANTIA]");
    if(!IsPlayerConnected(zID)) return SendClientMessage(playerid, -1, "Player nгo connectado!");
    Cocaina[zID] += zQuantia;
    GetPlayerName(playerid,zNome,MAX_PLAYER_NAME);
    format(zString,sizeof(zString),"O Admin %s te deu %d de cocaina!", zNome, zQuantia);
    SendClientMessage(zID, -1, zString);
    return 1;
}

CMD:darmaconha(playerid, params[])
{
    new zID, zQuantia, zString[128], zNome[MAX_PLAYER_NAME];
    if(sscanf(params, "ud", zID, zQuantia)) return SendClientMessage(playerid, -1, "USE: /darmaconha [ID] [QUANTIA]");
    if(!IsPlayerConnected(zID)) return SendClientMessage(playerid, -1, "Player nгo connectado!");
    Maconha[zID] += zQuantia;
    GetPlayerName(playerid,zNome,MAX_PLAYER_NAME);
    format(zString,sizeof(zString),"O Admin %s te deu %d de maconha!", zNome, zQuantia);
    SendClientMessage(zID, -1, zString);
    return 1;
}
Se ajudei, +rep!


Re: /darmaconha e /darcocaina - maluco88 - 15.09.2012

vlw mais tipow tentei deixar ele em comando mesmo sem ser FS:
pawn Код:
if(strcmp(cmd, "/darcocaina", true) == 0)
    {
    new zID, zQuantia, zString[128], zNome[MAX_PLAYER_NAME];
    if(sscanf(params, "ud", zID, zQuantia)) return SendClientMessage(playerid, -1, "USE: /darcocaina [ID] [QUANTIA]");
    if(!IsPlayerConnected(zID)) return SendClientMessage(playerid, -1, "Player nгo connectado!");
    Cocaina[zID] += zQuantia;
    GetPlayerName(playerid,zNome,MAX_PLAYER_NAME);
    format(zString,sizeof(zString),"O Admin %s te deu %d de cocaina!", zNome, zQuantia);
    SendClientMessage(zID, -1, zString);
    return 1;
}

    if(strcmp(cmd, "/darmaconha", true) == 0)
    {
    new zID, zQuantia, zString[128], zNome[MAX_PLAYER_NAME];
    if(sscanf(params, "ud", zID, zQuantia)) return SendClientMessage(playerid, -1, "USE: /darmaconha [ID] [QUANTIA]");
    if(!IsPlayerConnected(zID)) return SendClientMessage(playerid, -1, "Player nгo connectado!");
    Maconha[zID] += zQuantia;
    GetPlayerName(playerid,zNome,MAX_PLAYER_NAME);
    format(zString,sizeof(zString),"O Admin %s te deu %d de maconha!", zNome, zQuantia);
    SendClientMessage(zID, -1, zString);
    return 1;
}
olha que deu: 2 warnings acho que e fбcil de resolver:
Код:
C:\Users\Familia\Desktop\bgt\admin.PWN(2354) : error 017: undefined symbol "params"
C:\Users\Familia\Desktop\bgt\admin.PWN(2366) : error 017: undefined symbol "params"
linhas:
Код:
2354:    if(sscanf(params, "ud", zID, zQuantia)) return SendClientMessage(playerid, -1, "USE: /darcocaina [ID] [QUANTIA]"); 
2366:    if(sscanf(params, "ud", zID, zQuantia)) return SendClientMessage(playerid, -1, "USE: /darmaconha [ID] [QUANTIA]");



Re: /darmaconha e /darcocaina - CeLo Jeaam - 15.09.2012

Our ta you for trying ZCMD in strcmp, study more about pwn.


Re: /darmaconha e /darcocaina - maluco88 - 15.09.2012

ALGUЙM AJUDA '-'


Re: /darmaconha e /darcocaina - maluco88 - 16.09.2012

;/ nгo tem geito de deixar em cmd normal?