strfind error?
#1

Код:
if(strcmp(cmd, "/pay", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, -1, "{FFFFFF}(( {FFCC00}Exemplu folosire : {FF9930} /pay [PlayerID/Nume Jucator] {FFFFFF}))");
				return 1;
			}
	        giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, -1, "{FFFFFF}(( {FFCC00}Exemplu folosire : {FF9930} /pay [PlayerID/Nume Jucator] {FFFFFF}))");
				return 1;
			}
			moneys = strvalEx(tmp);
			if(moneys < 1 || moneys > 1000000)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}(( {FFCC00}Informatie -{FF9930} Suma minima 1$ - Suma maxima 1.000.000 ${FFFFFF}))");
			    return 1;
			}
            if(strfind(moneys, "-", true) != -1) //error
            {
				SendClientMessage(playerid, -1, "{FFFFFF}(( {FFCC00}Exemplu folosire : {FF9930} /pay [PlayerID/Nume Jucator] {FFFFFF}))");
				return 1;
			}			
			if(IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid == playerid) { SendClientMessage(playerid, -1, "{FFFFFF}(( {FFCC00}Informatie - {FF9930} aceasta comanda trebuie executata pe alta persoana {FFFFFF}))"); return 1; }
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
					if(ProxDetectorS(5.0, playerid, giveplayerid))
					{
						GetPlayerName(playerid, sendername, sizeof(sendername));
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						new playermoney = GetPlayerMoney(playerid);
						if(moneys > 0 && playermoney >= moneys)
						{
						    new string[250];
						    PlayerInfo[playerid][Valuta] = PlayerInfo[playerid][Valuta]-moneys;
							GivePlayerMoney(playerid, (0 - moneys));
							PlayerInfo[giveplayerid][Valuta] = PlayerInfo[giveplayerid][Valuta]+moneys;
							GivePlayerMoney(giveplayerid, moneys);
							format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.",sendername,giveplayer);
	                        ProxDetector(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, string);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
							format(string, sizeof(string), "~r~-%d$",moneys);
							GameTextForPlayer(playerid, string, 5000, 1);
							format(string, sizeof(string), "~g~+%d$",moneys);
							GameTextForPlayer(giveplayerid, string, 5000, 1);							
						}
						else
						{
							SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}(( {FFCC00}Informatie -{FF9930} n-ai aceasta suma in posesie , din pacate! {FFFFFF}))");
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}(( {FFCC00}Informatie -{FF9930} trebuie sa stai langa jucator{FFFFFF}))");
					}
				}
			}
			else
			{
			    new string[256];
				format(string, sizeof(string), "{FFFFFF}(( {FFCC00}Informatie -{FF9930} jucatorul acesta este offline! {FFFFFF}))");
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
    }
- The bug was : if i type /pay PLAYER -1 (the player goes -1 cash , not +1 )
i want to fix that .. to don't work if you type in the command -
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)