SA-MP Forums Archive
Ayuda en comando - 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: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Ayuda en comando (/showthread.php?tid=274738)



Ayuda en comando - godoy32 - 07.08.2011

Hola, soy un poco nuevo en esto del pawno... y tengo un pequсo problema...
quiero hacer, que al poner "/castigar [ID]" lo lleve a un lugar y que le bloque los comandos... esto es lo que llevo, pero al momento de poner /castigar 1 sale que no existe y si lo pongo solo, es decir, /castigar castiga a la id 0...
pawn Код:
if(strcmp(cmdtext,"/castigar",true)==0)
            {

            cmd = strtok(cmdtext, idx);
            if(!strlen(cmd))
            {
                SendClientMessage(playerid, COLOR_WHITE, "Usa: /castigar [ID]");
               
            }
            giveplayerid = strval(cmd);
            if(AccountInfo[giveplayerid][aBloqueado] == 1) return SendClientMessage(playerid,COLOR_WHITE,"Ya esta bloqueado");
            if (IsPlayerConnected(giveplayerid))
            {
                SetPlayerInterior(playerid,0);
                TeleportPlayer(playerid,3970.806,642.907,44.383);
                SendClientMessage(playerid, COLOR_WHITE, "COMPORTATE!");
                GameTextForPlayer(playerid," ~w~ ESTAS ~r~ CASTIGADO!",10000,6);
                new string[256], pname[MAX_PLAYER_NAME];
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                AccountInfo[giveplayerid][aBloqueado] = 1;
                format(string,sizeof(string),"* Has castigado a %s!",giveplayer);
                SendClientMessage(playerid,COLOR_ADMIN,string);
                format(string, sizeof(string), "AdminCmd: %s Te ha bloqueado los comandos",sendername);
                SendClientMessage(giveplayerid,COLOR_ADMIN,string);
            } else {
                format(string, sizeof(string), "A quien esperas bloquear si el ID %d No esta conectado.", giveplayerid);
                SendClientMessage(playerid, COLOR_WHITE, string);
            }
    return 1;
    }
De ante mano, gracias.


Respuesta: Ayuda en comando - TheChaoz - 07.08.2011

intenta asi:
pawn Код:
if(!strcmp(cmdtext,"/castigar",true)){
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))return SendClientMessage(playerid, COLOR_WHITE, "Usa: /castigar [ID]");
    new str[128], id = strval(tmp);
    if(AccountInfo[id][aBloqueado] == 1) return SendClientMessage(playerid,COLOR_WHITE,"Ya esta bloqueado");
    if(IsPlayerConnected(id)){
        new name[2][MAX_PLAYER_NAME];
        SetPlayerInterior(playerid,0);
        TeleportPlayer(playerid,3970.806, 642.907, 44.383);
        SendClientMessage(id, COLOR_WHITE, "COMPORTATE!");
        GameTextForPlayer(id, " ~w~ ESTAS ~r~ CASTIGADO!", 10000, 6);
        GetPlayerName(id, name[0], MAX_PLAYER_NAME);
        GetPlayerName(playerid, name[1], MAX_PLAYER_NAME);
        AccountInfo[giveplayerid][aBloqueado] = 1;
        format(str, 128, "* Has castigado a %s!", name[0]);
        SendClientMessage(playerid, COLOR_ADMIN, str);
        format(str, 128, "AdminCmd: %s Te ha bloqueado los comandos", name[1]);
        return SendClientMessage(id, COLOR_ADMIN, str);
    }
    else{
        format(str, 128, "A quien esperas bloquear si el ID %d No esta conectado.", id);
        return SendClientMessage(playerid, COLOR_WHITE, string);
    }
}



Respuesta: Ayuda en comando - godoy32 - 07.08.2011

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
intenta asi:
pawn Код:
if(!strcmp(cmdtext,"/castigar",true)){
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))return SendClientMessage(playerid, COLOR_WHITE, "Usa: /castigar [ID]");
    new str[128], id = strval(tmp);
    if(AccountInfo[id][aBloqueado] == 1) return SendClientMessage(playerid,COLOR_WHITE,"Ya esta bloqueado");
    if(IsPlayerConnected(id)){
        new name[2][MAX_PLAYER_NAME];
        SetPlayerInterior(playerid,0);
        TeleportPlayer(playerid,3970.806, 642.907, 44.383);
        SendClientMessage(id, COLOR_WHITE, "COMPORTATE!");
        GameTextForPlayer(id, " ~w~ ESTAS ~r~ CASTIGADO!", 10000, 6);
        GetPlayerName(id, name[0], MAX_PLAYER_NAME);
        GetPlayerName(playerid, name[1], MAX_PLAYER_NAME);
        AccountInfo[giveplayerid][aBloqueado] = 1;
        format(str, 128, "* Has castigado a %s!", name[0]);
        SendClientMessage(playerid, COLOR_ADMIN, str);
        format(str, 128, "AdminCmd: %s Te ha bloqueado los comandos", name[1]);
        return SendClientMessage(id, COLOR_ADMIN, str);
    }
    else{
        format(str, 128, "A quien esperas bloquear si el ID %d No esta conectado.", id);
        return SendClientMessage(playerid, COLOR_WHITE, string);
    }
}
ahora cuando pongo /castigar me dice que "usa: /castigar [ID]", y cuando pongo "/castigar 1" dice que no existe.


Respuesta: Ayuda en comando - M1tux3r - 07.08.2011

Cambia: if(!strcmp(cmdtext,"/castigar",true))

Por: if(!strcmp(cmd,"/castigar",true))


Respuesta: Ayuda en comando - godoy32 - 07.08.2011

Quote:
Originally Posted by M1tux3r
Посмотреть сообщение
Cambia: if(!strcmp(cmdtext,"/castigar",true))

Por: if(!strcmp(cmd,"/castigar",true))
gracias ahн me funciono

pero cuando pongo /castigar 1, por ejemplo, el que se transporta al lugar soy yo y no el otro :S


Respuesta: Ayuda en comando - M1tux3r - 07.08.2011

TeleportPlayer(playerid,3970.806, 642.907, 44.383);
SetPlayerInterior(playerid, 0);

cambia el texto en rojo por: id


Respuesta: Ayuda en comando - godoy32 - 07.08.2011

Quote:
Originally Posted by M1tux3r
Посмотреть сообщение
TeleportPlayer(playerid,3970.806, 642.907, 44.383);
SetPlayerInterior(playerid, 0);

cambia el texto en rojo por: id
gracias por todo... ahora esta funcionando bien