need help with race
#1

Ok so I tryed to made winer place for my race, but there's something bad and I don't know what is wrong.It should be like that: when first player enters into the last checkpoint, it disables and player gets message in the chatbox that he won the game, because he first and he gets 10000$, oh and the last point, that everyone who was participating in the race gets the message that concrete player won the race and for them also disappear all checkpoints, which are left.So I will show you the last code lines, because everything what I wrote recently is these lines:
Код:
	else if(cp[playerid] == 15)
	{
	cp[playerid] = SetPlayerRaceCheckpoint(playerid, 1, -2329.8938,-1607.2220,483.5648, 0.0,0.0,0.0, 9);
	cp[playerid] = 16;
	}
	else if(cp[playerid] == 16)
	{
	DisablePlayerRaceCheckpoint(playerid);
	new Float:x,Float:y,Float:z;
	position = GetVehiclePos(playerid, x, y, z);
	position == 16
 	SendClientMessage(playerid, 0xFFFFFAA, "Tu esi nugaletojas-sveikiname!!!");
	new zaidejas1[100];
	new pname[MAX_PLAYERS];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(zaidejas1, sizeof(zaidejas1), "Lenktynes baigtos! %s jas laimejo ir gavo 10000litu!", pname);
	SendClientMessageToAll(0xFFFFFAA, zaidejas1);
	GivePlayerMoney(playerid, 10000);
	}
	return 1;
}
So how you see what I wrote in the code I think is correct, because there is no errors while compiling.But when I'm in the game and participating in the race, in the last cp(checkpoint) I get nothing-no money,no message...So what is the problem in these lines, maybe i need to write it differently?Thank you for the help!
Reply
#2

REFRESH!
Reply
#3

pawn Код:
new Float:x,Float:y,Float:z;
position = GetVehiclePos(playerid, x, y, z);
position == 16
What should this part do?
Reply
#4

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
pawn Код:
new Float:x,Float:y,Float:z;
position = GetVehiclePos(playerid, x, y, z);
position == 16
What should this part do?
Oh, so there are variables, these are used to get the player position, so I get position with function GetVehiclePos how you see, and store it into next variable position and than if it's equal to the checkpoint 16 position it will do what I wrote after it.So that's what these code lines doing.
Reply
#5

Quote:
Originally Posted by karakana7
Посмотреть сообщение
Oh, so there are variables, these are used to get the player position, so I get position with function GetVehiclePos how you see, and store it into next variable position and than if it's equal to the checkpoint 16 position it will do what I wrote after it.So that's what these code lines doing.
I'm not so sure about it. Try removing this part.
Reply
#6

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
I'm not so sure about it. Try removing this part.
But how to do that when this player enters first the last cp, so for everyone all checkpoints disappear and they teleport to the race start?
Reply
#7

pawn Код:
for(new i=0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        DisablePlayerRaceCheckpoint(i);
    }
}
Reply
#8

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
pawn Код:
for(new i=0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        DisablePlayerRaceCheckpoint(i);
    }
}
Thank you!But where I need to put it?
Reply
#9

When I edit previous code to this:
Код:
	else if(cp[playerid] == 15)
	{
	cp[playerid] = SetPlayerRaceCheckpoint(playerid, 1, -2329.8938,-1607.2220,483.5648, 0.0,0.0,0.0, 4);
	cp[playerid] = 16;
	}
	else if(cp[playerid] == 16)
	{
	DisablePlayerRaceCheckpoint(playerid);
 	SendClientMessage(playerid, 0xFFFFFAA, "Tu esi nugaletojas-sveikiname!!!");
	new zaidejas1[100];
	new pname[MAX_PLAYERS];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(zaidejas1, sizeof(zaidejas1), "Lenktynes baigtos! %s jas laimejo ir gavo 10000litu!", pname);
	SendClientMessageToAll(0xFFFFFAA, zaidejas1);
	GivePlayerMoney(playerid, 10000);
	for(new i=0; i<MAX_PLAYERS; i++)
	{
	if(IsPlayerConnected(i))
	{
	DisablePlayerRaceCheckpoint(i);
	}
	return 1;
}
I get these errors:
Код:
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(251) : warning 217: loose indentation
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(251) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(251) : error 004: function "OnPlayerLeaveRaceCheckpoint" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(256) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(256) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(256) : error 004: function "OnRconCommand" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(261) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(261) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(261) : error 004: function "OnPlayerRequestSpawn" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(266) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(266) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(266) : error 004: function "OnObjectMoved" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(271) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(271) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(271) : error 004: function "OnPlayerObjectMoved" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(276) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(276) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(276) : error 004: function "OnPlayerPickUpPickup" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(282) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(282) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(282) : error 004: function "OnVehicleMod" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(287) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(287) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(287) : error 004: function "OnVehiclePaintjob" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(292) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(292) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(292) : error 004: function "OnVehicleRespray" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(297) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(297) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(297) : error 004: function "OnPlayerSelectedMenuRow" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(302) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(302) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(302) : error 004: function "OnPlayerExitedMenu" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(307) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(307) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(307) : error 004: function "OnPlayerInteriorChange" is not implemented
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(312) : warning 225: unreachable code
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(312) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justas\Desktop\samp\gamemodes\gyvenimas.pwn(312) : error 004: function "OnPlayerKeyStateChange" is not implemented

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#10

put 2 } then you wont get all them errors

EDIT:

pawn Код:
else if(cp[playerid] == 15)
    {
    cp[playerid] = SetPlayerRaceCheckpoint(playerid, 1, -2329.8938,-1607.2220,483.5648, 0.0,0.0,0.0, 4);
    cp[playerid] = 16;
    }
    else if(cp[playerid] == 16)
    {
    DisablePlayerRaceCheckpoint(playerid);
    SendClientMessage(playerid, 0xFFFFFAA, "Tu esi nugaletojas-sveikiname!!!");
    new zaidejas1[100];
    new pname[MAX_PLAYERS];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(zaidejas1, sizeof(zaidejas1), "Lenktynes baigtos! %s jas laimejo ir gavo 10000litu!", pname);
    SendClientMessageToAll(0xFFFFFAA, zaidejas1);
    GivePlayerMoney(playerid, 10000);
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    DisablePlayerRaceCheckpoint(i);
    }
    return 1;
        }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)