SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 26/03/2020, 01:22 AM   #1
pushline
Little Clucker
 
pushline's Avatar
 
Join Date: Dec 2018
Posts: 35
Reputation: 0
Default function x should return a value

oi, tá com return 1; no final e pede return a value. '-'

Code:
GetPlayerWon()
{

	new index, tmp[256], strtxd[256], str2[256], oKills = Countkillsround();
	if(Countkillsround() > 0)
	{
	    foreach(Player,i)
		{
			if(rKills[i] > rKills[TopPlayer]) //rKills tá definido com global :P
				TopPlayer = i;
		} //foreach

		SendClientMessageToAll(-1,""); // Limpando chat
		SendClientMessageToAll(-1,"");


		tmp[0] = EOS;
		format(tmp, 100, "~ Next location will be on the map: {FFFFFF}%s", mapname);
		SendClientMessageToAll(COLOR_ORANGE, strtxd);
		SendClientMessageToAll(COLOR_ORANGE, "» All accounts have been saved.");
		SendClientMessageToAll(-1,"");

		quickSort(resultsindex, 0, index);

		GameTextForPlayer(resultsindex[0][player_ID], "~w~Victory!", 3000, 1);
		PlayerPlaySound(resultsindex[0][player_ID],1058,0.0,0.0,0.0);

		new scorefinalwinner, scorefinal;
		foreach(Player, i)
		{ // foreach
			if(IsPlayerConnected(i) && APlayerData[i][Logado] && Duelo[i] == 998 && AFK[i] == false)
			{
				TextDrawShowForPlayer(i, HUD[8]);
				TextDrawShowForPlayer(i, HUD[9]);
				TextDrawShowForPlayer(i, HUD[10]);
				TextDrawShowForPlayer(i, HUD[11]);
				TextDrawShowForPlayer(i, HUD[12]);
				TextDrawShowForPlayer(i, HUD[13]);
				TextDrawShowForPlayer(i, HUD[14]);
			}
			rKills[i] = 0;
			rDeaths[i] = 0;
			damageperplayer[i] = 0;
			
			new tmpscorefinal = randomEx(50, 150);
			new tmpscorefinalwinner = randomEx(100,300);
			if(i == resultsindex[0][player_ID])
			{
				scorefinalwinner = tmpscorefinalwinner * rKills[i];
				SetPlayerScore(i, GetPlayerScore(i) + scorefinalwinner);
			}
			else
			{
				scorefinal = tmpscorefinal * rKills[i];
				SetPlayerScore(i, GetPlayerScore(i) + scorefinal);
			}
		} // foreach

		if(oKills > 0){	
			format(strtxd, 140, "~ {FFFFFF}%d Kills were counted {FFFFFF}in this round!", oKills);
			format(str2, 140, "~ {FFFFFF} The top 1 player with more kills is: ", pName[TopPlayer]);
			SendClientMessageToAll(COLOR_ORANGE, strtxd);
			SendClientMessageToAll(COLOR_ORANGE, str2);
		} // if kills

		SendClientMessageToAll(-1,"");

		
}
	return 1;
}
pushline is offline   Reply With Quote
Old 27/03/2020, 02:36 AM   #2
pushline
Little Clucker
 
pushline's Avatar
 
Join Date: Dec 2018
Posts: 35
Reputation: 0
Default Re: function x should return a value

up? alguém por favor
pushline is offline   Reply With Quote
Old 27/03/2020, 03:33 AM   #3
LuanSousa
Little Clucker
 
LuanSousa's Avatar
 
Join Date: Jan 2020
Location: [Brasil] Petrolina - PE
Posts: 6
Reputation: 0
Default Re: function x should return a value

Testa ai...

pawn Code:
GetPlayerWon()
{

    new index, tmp[256], strtxd[256], str2[256], oKills = Countkillsround();
    if(Countkillsround() > 0)
    {
        foreach(Player,i)
        {
            if(rKills[i] > rKills[TopPlayer]) //rKills tá definido com global :P
                TopPlayer = i;
        } //foreach

        SendClientMessageToAll(-1,""); // Limpando chat
        SendClientMessageToAll(-1,"");


        tmp[0] = EOS;
        format(tmp, 100, "~ Next location will be on the map: {FFFFFF}%s", mapname);
        SendClientMessageToAll(COLOR_ORANGE, strtxd);
        SendClientMessageToAll(COLOR_ORANGE, "» All accounts have been saved.");
        SendClientMessageToAll(-1,"");

        quickSort(resultsindex, 0, index);

        GameTextForPlayer(resultsindex[0][player_ID], "~w~Victory!", 3000, 1);
        PlayerPlaySound(resultsindex[0][player_ID],1058,0.0,0.0,0.0);

        new scorefinalwinner, scorefinal;
        foreach(Player, i)
        { // foreach
            if(IsPlayerConnected(i) && APlayerData[i][Logado] && Duelo[i] == 998 && AFK[i] == false)
            {
                TextDrawShowForPlayer(i, HUD[8]);
                TextDrawShowForPlayer(i, HUD[9]);
                TextDrawShowForPlayer(i, HUD[10]);
                TextDrawShowForPlayer(i, HUD[11]);
                TextDrawShowForPlayer(i, HUD[12]);
                TextDrawShowForPlayer(i, HUD[13]);
                TextDrawShowForPlayer(i, HUD[14]);
            }
            rKills[i] = 0;
            rDeaths[i] = 0;
            damageperplayer[i] = 0;
           
            new tmpscorefinal = randomEx(50, 150);
            new tmpscorefinalwinner = randomEx(100,300);
            if(i == resultsindex[0][player_ID])
            {
                scorefinalwinner = tmpscorefinalwinner * rKills[i];
                SetPlayerScore(i, GetPlayerScore(i) + scorefinalwinner);
            }
            else
            {
                scorefinal = tmpscorefinal * rKills[i];
                SetPlayerScore(i, GetPlayerScore(i) + scorefinal);
            }
        } // foreach

        if(oKills > 0)
        {  
            format(strtxd, 140, "~ {FFFFFF}%d Kills were counted {FFFFFF}in this round!", oKills);
            format(str2, 140, "~ {FFFFFF} The top 1 player with more kills is: ", pName[TopPlayer]);
            SendClientMessageToAll(COLOR_ORANGE, strtxd);
            SendClientMessageToAll(COLOR_ORANGE, str2);
        } // if kills

        SendClientMessageToAll(-1,"");
    }
    return 1;
}
__________________
Trabalhando em algo interessante...
LuanSousa is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
function should return a value? But i use return.. faxxe Scripting Help 4 21/03/2017 10:08 PM
Returning inside a switch case, does it go back to the scope of the function, or does it return for the function? Hoborific Scripting Help 3 26/06/2013 12:47 PM
return function. -CyRAX Scripting Help 6 30/03/2013 05:08 PM
Function should return a value McCarthy Scripting Help 5 18/09/2011 10:48 AM
Function that return more than 1 value. CoaPsyFactor Help Archive 4 24/08/2010 01:57 PM


All times are GMT. The time now is 08:44 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.