[AJUDA] Comando Simples
#1

Galera eu queria que o cara mostrasse os documentos para o policial , tipo assim:
pawn Код:
if(strcmp("/rg", cmdtext, true, 10) == 0){
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
SendClientMessage(playerid, verdel,"====================== RG ======================");
format(string, sizeof(string), "Level Atual: %d", dini_Int(file, "Level"));
SendClientMessage(playerid, 0xFFFFFFAA, string);
format(string, sizeof(string), "Crйditos cartгo telefonico: %d | Combustivel %d.",dini_Int(file, "CartaoTelefonico"), dini_Int(file, "Combustivel"));
SendClientMessage(playerid, 0xFFFFFFAA, string);
format(string, sizeof(string), "%d Celular(s) | %d mp3 | Skin numero %d ", dini_Int(file, "Celular"), dini_Int(file, "MP3"), dini_Int(file, "Skin"));
SendClientMessage(playerid, 0xFFFFFFAA, string);
if(dini_Int(file, "Porte") == 1){
SendClientMessage(playerid, 0xFFFFFFAA, "Porte de Armas: Sim");
}
if(dini_Int(file, "Porte") == 0){
SendClientMessage(playerid, 0xFFFFFFAA, "Porte de Armas: Sim");
}
if(dini_Int(file, "HabTerrestre") == 1){
SendClientMessage(playerid, 0xFFFFFFAA, "Carteira Terrestre: Sim");
}
if(dini_Int(file, "HabTerrestre") == 0){
SendClientMessage(playerid, 0xFFFFFFAA, "Carteira Terrestre: Nao");
}
if(dini_Int(file, "HabNautica") == 1){
SendClientMessage(playerid, 0xFFFFFFAA, "Carteira Nautica: Sim");
}
if(dini_Int(file, "HabNautica") == 0){
SendClientMessage(playerid, 0xFFFFFFAA, "Carteira Nautica: Nao");
}
if(dini_Int(file, "HabAerea") == 1){
SendClientMessage(playerid, 0xFFFFFFAA, "Carteira Aerea: Sim");
}
if(dini_Int(file, "HabAerea") == 0){
SendClientMessage(playerid, 0xFFFFFFAA, "Carteira Aerea: Nao");
}
return 1;
}
Envez de ele ver o rg ele mandar o RG para o policial ae aparece: jogador tals mostrou o documentos para vocК ae mostra isso ae em cima, so que o jogador colocar /mostrardocumentos [id] id do policial
Reply
#2

se fose em zcmd + sscanf eu atй fazeria mais strcmp e strtok nao mecho =/

up ae para alguem ajudar tigo.
Reply
#3

Acho que й isso aqui:

pawn Код:
if(strcmp("/mostrarrg", cmdtext, true) == 0)
    {
        new aname[MAX_PLAYER_NAME];
        new outro;
        tmp = strtok(cmdtext, Index);
        outro = strval(tmp);
        if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFAA, "Uso: /mostrarrg [id]");
        GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
        format(file, sizeof(file), PASTA_CONTAS, aname);
        SendClientMessage(outro, verdel,"====================== RG ======================");
        format(string, sizeof(string), "Level Atual: %d", dini_Int(file, "Level"));
        SendClientMessage(outro, 0xFFFFFFAA, string);
        format(string, sizeof(string), "Crйditos cartгo telefonico: %d | Combustivel %d.",dini_Int(file, "CartaoTelefonico"), dini_Int(file, "Combustivel"));
        SendClientMessage(outro, 0xFFFFFFAA, string);
        format(string, sizeof(string), "%d Celular(s) | %d mp3 | Skin numero %d ", dini_Int(file, "Celular"), dini_Int(file, "MP3"), dini_Int(file, "Skin"));
        SendClientMessage(outro, 0xFFFFFFAA, string);
        if(dini_Int(file, "Porte") == 1)
            {
                SendClientMessage(outro, 0xFFFFFFAA, "Porte de Armas: Sim");
            }
        if(dini_Int(file, "Porte") == 0)
            {
                SendClientMessage(outro, 0xFFFFFFAA, "Porte de Armas: Sim");
            }
        if(dini_Int(file, "HabTerrestre") == 1)
            {
                SendClientMessage(outro, 0xFFFFFFAA, "Carteira Terrestre: Sim");
            }
        if(dini_Int(file, "HabTerrestre") == 0)
            {
                SendClientMessage(outro, 0xFFFFFFAA, "Carteira Terrestre: Nao");
            }
        if(dini_Int(file, "HabNautica") == 1)
            {
                SendClientMessage(outro, 0xFFFFFFAA, "Carteira Nautica: Sim");
            }
        if(dini_Int(file, "HabNautica") == 0)
            {
                SendClientMessage(outro, 0xFFFFFFAA, "Carteira Nautica: Nao");
            }
        if(dini_Int(file, "HabAerea") == 1)
            {
                SendClientMessage(outro, 0xFFFFFFAA, "Carteira Aerea: Sim");
            }
        if(dini_Int(file, "HabAerea") == 0)
            {
                SendClientMessage(outro, 0xFFFFFFAA, "Carteira Aerea: Nao");
            }
        return 1;
    }
nгo testei. mais creio q esteja funcionando ^^
Reply
#4

Seguintes erros:
Код:
C:\Users\Guilherme\Desktop\Brasil Games\gamemodes\novogmsemcasa.pwn(14140) : error 017: undefined symbol "tmp"
C:\Users\Guilherme\Desktop\Brasil Games\gamemodes\novogmsemcasa.pwn(14140) : error 017: undefined symbol "Index"
C:\Users\Guilherme\Desktop\Brasil Games\gamemodes\novogmsemcasa.pwn(14141) : error 017: undefined symbol "tmp"
C:\Users\Guilherme\Desktop\Brasil Games\gamemodes\novogmsemcasa.pwn(14142) : error 017: undefined symbol "tmp"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Aproveitando o erro , queria que mostrasse a menssagem para o policial assim, "Tal" player mostrou o documento para vocк!
Reply
#5

Coloque isso no final do seu GameMode

PHP код:
strtok(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' '))
    {
        
index++;
    }
 
    new 
offset index;
    new 
result[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;

Reply
#6

Quote:
Originally Posted by Đeagle
Посмотреть сообщение
Coloque isso no final do seu GameMode

PHP код:
strtok(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' '))
    {
        
index++;
    }
 
    new 
offset index;
    new 
result[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;

Nem deu ... :/
Reply
#7

Quote:
Originally Posted by GuiihCamargo
Посмотреть сообщение
Seguintes erros:
Код:
C:\Users\Guilherme\Desktop\Brasil Games\gamemodes\novogmsemcasa.pwn(14140) : error 017: undefined symbol "tmp"
C:\Users\Guilherme\Desktop\Brasil Games\gamemodes\novogmsemcasa.pwn(14140) : error 017: undefined symbol "Index"
C:\Users\Guilherme\Desktop\Brasil Games\gamemodes\novogmsemcasa.pwn(14141) : error 017: undefined symbol "tmp"
C:\Users\Guilherme\Desktop\Brasil Games\gamemodes\novogmsemcasa.pwn(14142) : error 017: undefined symbol "tmp"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Aproveitando o erro , queria que mostrasse a menssagem para o policial assim, "Tal" player mostrou o documento para vocк!
coloca logo abaixo de OnPlayerCommandText

new cmd[128], cmd[128], Index;
cmd = strtok(cmdtext,Index);

e acrescenta no comando, antes do return 1;
format(string, sizeof(string), "O meliante: %s lhe mostrou os documentos", aname);
SendClientMessage(outro, 0xFFFFFFAA, string);
Reply
#8

Consegui fazer o COMANDO, pra quem ta interessado vou postar:
pawn Код:
if(strcmp(cmd, "/documentos", true) == 0) {
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_GREEN, "Use /documentos [id].");
return 1;
}
plid = strval(tmp);
if(IsPlayerConnected(plid)){
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), P_CONTAS, aname);
new string222[256];
format(string222, sizeof(string222), "» Documentos de: %s", aname);
SendClientMessage(plid, 0x4E9C9CAA, string222);
if(dini_Int(file, "HabTerrestre") == 1){
SendClientMessage(plid, 0xFFFFFFAA, "» Habilitaзгo Terrestre: Sim");
}
if(dini_Int(file, "HabTerrestre") == 0){
SendClientMessage(plid, 0xFFFFFFAA, "» Habilitaзгo Terrestre: Nгo");
}
if(dini_Int(file, "HabNautica") == 1){
SendClientMessage(plid, 0xFFFFFFAA, "» Habilitacao Nбutica: Sim");
}
if(dini_Int(file, "HabNautica") == 0){
SendClientMessage(plid, 0xFFFFFFAA, "» Habilitaзгo Nбutica: Nгo");
}
if(dini_Int(file, "HabAerea") == 1){
SendClientMessage(plid, 0xFFFFFFAA, "» Habilitaзгo Aйrea: Sim");
}
if(dini_Int(file, "HabAerea") == 0){
SendClientMessage(plid, 0xFFFFFFAA, "» Habilitaзгo Aйrea: Nгo");
}
if(dini_Int(file, "Porte") == 1){
SendClientMessage(plid, 0xFFFFFFAA, "» Porte de Armas: Sim");
}
if(dini_Int(file, "Porte") == 0){
SendClientMessage(plid, 0xFFFFFFAA, "» Porte de Armas: Nгo");
}
format(string, sizeof(string), "{CCCCFF} Documentos mostrados para %s.", pname);
SendClientMessage(playerid, 0x4E9C9CAA, string);
format(string, sizeof(string), "{CCCCFF} %s lhe mostrou seus documentos!", aname);
SendClientMessage(plid, 0x4E9C9CAA, string);

return 1;
}else{
SendClientMessage(playerid, Vermelho, "(ERRO) ID invбlido");
return 1;
}
}
Reply
#9

@EDIT
Desculpe-me pelo post, nгo havia visto que o problema tinha sido resolvido.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)