SA-MP Forums Archive
[AJUDA] /cadeia - 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] /cadeia (/showthread.php?tid=286992)



[AJUDA] /cadeia - RedBulL_x - 01.10.2011

Criei um comando /cadeia [id] [tempo] [motivo], Deu certo o ID e o TEMPO, Mais o MOTIVO Nгo. Eu coloco o motivo ae Nгo aparece, as vezes so a 1° frase ou um . Segue o code do comando abaicho.

Код:
if(strcmp(cmd, "/cadeia",true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        new tempo[20];
	        new motivo[64];
	        new tempo2;
	        if(PlayerInfo[playerid][pAdmin] < 1338)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo esta autorizado para usar este comando!");
	            return 1;
	        }
	        tmp = strtok(cmdtext, idx);
	        tempo = strtok(cmdtext, idx);
	        motivo = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USE: /cadeia [id] [Tempo] [Motivo] ");
				return 1;
			}
			if(!strlen(tempo))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USE: /cadeia [id] [Tempo] [Motivo] ");
				return 1;
			}
			if(PlayerInfo[giveplayerid][pAdmin] >= 1342 && PlayerInfo[playerid][pAdmin] < 1340)
			{
				SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo pode dar cadeia para um Admin Dono !");
				return 1;
			}
			if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != 1342 && PlayerInfo[playerid][pAdmin] != 1341)
			{
				SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/trabalhar)");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			tempo2 = strval(tempo);
		    if(IsPlayerConnected(giveplayerid))
		    {
		        if(giveplayerid != INVALID_PLAYER_ID)
		        {
		            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* {696969}%s {FF0000}Colocou {696969}%s {FF0000}Na Cadeia de Admin MOTIVO: {696969}%s.", sendername, giveplayer, motivo);
					SendClientMessageToAll(COLOR_LIGHTRED, string);
					if(admtrampando[playerid] == 1 && admhide[playerid] == 1)
					{
						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "* Vocк foi colocado na Cadeia de Admin pelo admin Forever_Alone.");
					}
					else
					{
						format(string, sizeof(string), "*  Vocк foi colocado na cadeia de admin Pelo Admin %s.", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
					}
					GameTextForPlayer(giveplayerid, "~b~Bem Vindo a ~n~~r~Cadeia Admin", 5000, 3);
					ResetPlayerWeaponsEx(giveplayerid);
					WantedPoints[giveplayerid] = 0;
      				SetPlayerWantedLevel(giveplayerid, 0);
					PlayerInfo[giveplayerid][pJailed] = 2;
					PlayerInfo[giveplayerid][pJailTime] = tempo2 * 60;
					SetPlayerInterior(giveplayerid, 6);
		            SetPlayerPos(giveplayerid, 264.3618,77.7751,1001.0391);
		        }
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   O jogador estб offline !");
			    return 1;
			}
	    }
	    return 1;
	}



Re : [AJUDA] /cadeia - [NWD]Jim._.Carrey - 01.10.2011

Tenta assim:
pawn Код:
if(strcmp(cmd, "/cadeia",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new tempo[20];
            new motivo[64];
            new tempo2;
            if(PlayerInfo[playerid][pAdmin] < 1338)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo esta autorizado para usar este comando!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            tempo = strtok(cmdtext, idx);
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /cadeia [id] [Tempo] [Motivo] ");
                return 1;
            }
            if(!strlen(tempo))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /cadeia [id] [Tempo] [Motivo] ");
                return 1;
            }
            if(PlayerInfo[giveplayerid][pAdmin] >= 1342 && PlayerInfo[playerid][pAdmin] < 1340)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo pode dar cadeia para um Admin Dono !");
                return 1;
            }
            if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != 1342 && PlayerInfo[playerid][pAdmin] != 1341)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/trabalhar)");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            tempo2 = strval(tempo);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "* {696969}%s {FF0000}Colocou {696969}%s {FF0000}Na Cadeia de Admin MOTIVO: {696969}%s.", sendername, giveplayer, result);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                    if(admtrampando[playerid] == 1 && admhide[playerid] == 1)
                    {
                        SendClientMessage(giveplayerid, COLOR_LIGHTRED, "* Vocк foi colocado na Cadeia de Admin pelo admin Forever_Alone.");
                    }
                    else
                    {
                        format(string, sizeof(string), "*  Vocк foi colocado na cadeia de admin Pelo Admin %s.", sendername);
                        SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
                    }
                    GameTextForPlayer(giveplayerid, "~b~Bem Vindo a ~n~~r~Cadeia Admin", 5000, 3);
                    ResetPlayerWeaponsEx(giveplayerid);
                    WantedPoints[giveplayerid] = 0;
                    SetPlayerWantedLevel(giveplayerid, 0);
                    PlayerInfo[giveplayerid][pJailed] = 2;
                    PlayerInfo[giveplayerid][pJailTime] = tempo2 * 60;
                    SetPlayerInterior(giveplayerid, 6);
                    SetPlayerPos(giveplayerid, 264.3618,77.7751,1001.0391);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   O jogador estб offline !");
                return 1;
            }
        }
        return 1;
    }



Re: [AJUDA] /cadeia - Miqueias Barros - 01.10.2011

pawn Код:
if(strcmp(cmd, "/cadeia",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new tempo[20];
            new motivo[64];
            new string[256];
            new tempo2;
            if(PlayerInfo[playerid][pAdmin] < 1338)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo esta autorizado para usar este comando!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            tempo = strtok(cmdtext, idx);
            motivo = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /cadeia [id] [Tempo] [Motivo] ");
                return 1;
            }
            if(!strlen(tempo))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /cadeia [id] [Tempo] [Motivo] ");
                return 1;
            }
            if(PlayerInfo[giveplayerid][pAdmin] >= 1342 && PlayerInfo[playerid][pAdmin] < 1340)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo pode dar cadeia para um Admin Dono !");
                return 1;
            }
            if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != 1342 && PlayerInfo[playerid][pAdmin] != 1341)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/trabalhar)");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            tempo2 = strval(tempo);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "* {696969}%s {FF0000}Colocou {696969}%s {FF0000}Na Cadeia de Admin MOTIVO: {696969}%s.", sendername, giveplayer, motivo);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                    if(admtrampando[playerid] == 1 && admhide[playerid] == 1)
                    {
                        SendClientMessage(giveplayerid, COLOR_LIGHTRED, "* Vocк foi colocado na Cadeia de Admin pelo admin Forever_Alone.");
                    }
                    else
                    {
                        format(string, sizeof(string), "*  Vocк foi colocado na cadeia de admin Pelo Admin %s.", sendername);
                        SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
                    }
                    GameTextForPlayer(giveplayerid, "~b~Bem Vindo a ~n~~r~Cadeia Admin", 5000, 3);
                    ResetPlayerWeaponsEx(giveplayerid);
                    WantedPoints[giveplayerid] = 0;
                    SetPlayerWantedLevel(giveplayerid, 0);
                    PlayerInfo[giveplayerid][pJailed] = 2;
                    PlayerInfo[giveplayerid][pJailTime] = tempo2 * 60;
                    SetPlayerInterior(giveplayerid, 6);
                    SetPlayerPos(giveplayerid, 264.3618,77.7751,1001.0391);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   O jogador estб offline !");
                return 1;
            }
        }
        return 1;
    }



AW: [AJUDA] /cadeia - RedBulL_x - 02.10.2011

Vlllw aк, Deu certo ganho Reput *-*


Re: [AJUDA] /cadeia - Miqueias Barros - 02.10.2011

Qual code funcionou? O meu ou dele?


AW: [AJUDA] /cadeia - RedBulL_x - 02.10.2011

Caraa eu testei 1° o seu e deu certo entгo nem mechi mais, Mas vllw aк os dois pela ajuda