SA-MP Forums Archive
[HELP] I have a problem with adding. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] I have a problem with adding. (/showthread.php?tid=258004)



[HELP] I have a problem with adding. - Type-R - 28.05.2011

Hello, i'm creating a derby minigame, and i ran into a problem. When a player gets into a checkpoint i want to record that he ran into a checkpoint, so i add 1 to mcp. The problem is that server, doesn't add anything to MCP, and i get a warning. here's the script:

OnPlayerEnterCheckpoint

Код:
else if(mgyra[playerid] == 1)
    {
        new randomss;
        new string1[15];
    	randomss = random(sizeof(Mgame1CP));
    	mcp[playerid]+1; // warning on this line
    	format(string1, sizeof(string1), "[%d/50] CP.", mcp[playerid]); // this always shows up as zero :/
   		GameTextForPlayer(playerid,string1, 3000, 4);
		for(new i; i < MAX_PLAYERS; i++)
		{
	    	if(mgyra[i] == 1)
	    	{
	    	    DisablePlayerRaceCheckpoint(i);
   				SetPlayerRaceCheckpoint(i,2,Mgame1CP[randomss][0], Mgame1CP[randomss][1], Mgame1CP[randomss][2],
     			0,0,0,15);
	    	}
		}
    }
I just want to add 1 to MCP when player enters a CheckPoint. Please help me.


Re: [HELP] I have a problem with adding. - Fj0rtizFredde - 28.05.2011

It should be +=
pawn Код:
mcp[playerid] +=1;
//Or you could just use ++ (Your choise)
mcp[playerid] ++;



Re: [HELP] I have a problem with adding. - Type-R - 28.05.2011

Thanks