[AJUDA] comando de dar drogas
#1

Galera to com um poblema que os player tгo dando droga negativa, tem como me ajudar ?

Код:
dcmd_dar(playerid, params[])
	{
	    if(IsPlayerConnected(playerid))
	    {
			new x_nr[256], idx;
			x_nr = strtok(params, idx);
			if(!strlen(x_nr))
			{
			    SendClientMessage(playerid, COLOR_WHITE, "USE: /dar [nome] [id/nick] ([qtde])");
				SendClientMessage(playerid, COLOR_WHITE, "Nomes disponiveis: drogas, armas");
				return 1;
			}
			if(strcmp(x_nr,"drogas",true)==0)
			{
       			new tmp[24]; tmp = strtok(params, idx);
			    if(!strlen(tmp))
					return SendClientMessage(playerid, COLOR_GREY, "ґ[USO] /dar drogas [id/nick] [qtd]");//givedrugs

				new giveid = ReturnUser(tmp);
				if(IsPlayerConnected(giveid))
				{
				    if(giveid != INVALID_PLAYER_ID)
				    {
				        if(IsACop(giveid))
				            return 1;

                        if(Treinando[giveid][0] > 0)
			   		    	return SendClientMessage(playerid,COLOR_RED,"{FF0000}[ERRO]{FFFFFF} Jogador estб treinando.");

				        new Float:x, Float:y, Float:z;
			            GetPlayerPos(giveid,x,y,z);
			            if(!PlayerToPoint(5, playerid, x, y, z))
			                return SendClientMessage(playerid, COLOR_GREY, "  O jogador nгo esta perto de vocк.");

      					tmp = strtok(params, idx);
						if(!strlen(tmp))
							return SendClientMessage(playerid, COLOR_GREY, "ґ[USO] /dardrogas [id/nick] [qtd]");

						new dammount;
						dammount = strval(tmp);
						if(dammount > Player[playerid][pDrugs])
							return SendClientMessage(playerid, COLOR_RED, "{FF0000}[ERRO]{FFFFFF} Vocк nгo tem nenhuma droga.");
						if(dammount = -strval(tmp)

						Player[playerid][pDrugs] -= dammount;
						Player[giveid][pDrugs] += dammount;
						if(Player[playerid][pSex] == 1) { format(thestring, sizeof(thestring), "%s deu drogas para %s.", Player[playerid][pName], Player[giveid][pName]); }
						else { format(thestring, sizeof(thestring), "%s deu drogas para %s.", Player[playerid][pName], Player[giveid][pName]); }
						ProxDetector(30.0, playerid, thestring, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
				}
				else
				    return SendClientMessage(playerid, COLOR_RED, "  O jogador esta Offline!");
			}
	}
Reply
#2

pawn Код:
if ( strfind ( tmp , "-" , true)  != -1 )
    return SendClientMessage ( playerid , -1 , " Vocк n pode usar (-) nesse CMD" ) ;
Reply
#3

Obrigado zbt , deu certinho. ja dei reputaзгo xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)