Jump to content

Recommended Posts

Posted

hello guys! if the player1 is at the finish line how to remove it to the player2 from the race and disable his racecheckpoint  

// commands
CMD:race(playerid, params[])
{
	new targetid, player2;
	if(sscanf(params, "u", targetid))
	{
	    return SCM(playerid, COLOR_SYNTAX, "Usage: /race [playerid]");
	}
	if(PlayerInfo[playerid][pRace])
	{
	   return SCM(playerid, COLOR_SYNTAX, "You are currently in the race, type /quitrace to quit the currently race event.");
	}
    if(!IsPlayerConnected(targetid))
	{
	    return SendClientMessage(playerid, COLOR_GREY, "The player specified is disconnected.");
	}
	if(targetid == playerid)
	{
	    return SCM(playerid, COLOR_SYNTAX, "You can't use this command on yourself.");
	}
	PlayerInfo[playerid][pRace] = 1;
	PlayerInfo[targetid][pRace] = 1;
	IsPlayerInRace[playerid] = 1;
	IsPlayerInRace[targetid] = 1;
	PlayerInfo[targetid][pPlayer2] = player2;
	//Player1 = IsPlayerInRace[playerid];
	//SetPlayerRaceCheckpoint( playerid, 0, raceCheckpoints[ 0 ][ 0 ], raceCheckpoints[ 0 ][ 1 ], raceCheckpoints[ 0 ][ 2 ], raceCheckpoints[ 1 ][ 3 ], raceCheckpoints[ 1 ][ 4 ], raceCheckpoints[ 1 ][ 5 ], 7.0 );
	ShowPlayerDialog(playerid, DIALOG_RACE, DIALOG_STYLE_LIST, "Select Vehicle", "Infernus\nTurismo\nNRG-500\nSuperGT\nBullet", "Select", "Cancel");
	return 1;
}

// example maded dialog
if(listitem == 0) // INFERNUS
				{
                    Vehicle1 = CreateVehicle(411, 403.526580, 2493.906005, 16.225225, 89.63, 0, 1, 0, 1);
                    PutPlayerInVehicle(playerid, Vehicle1, 0);
                    Vehicle2 = CreateVehicle(411, 403.405151, 2508.656250, 16.230072, 88.96, 0, 1, 0, 1);
                    PutPlayerInVehicle(player2, Vehicle2, 0);
                    startRace(playerid);
					startRace(player2);
                }

startRace(playerid)
{
	if(IsPlayerInRace[playerid])
	{
        IsPlayerInRace[playerid] = 1;
    	playerCheckpoint[playerid] = 0;
		SetPlayerRaceCheckpoint(playerid, 0, raceCheckpoints[0][0], raceCheckpoints[0][1], raceCheckpoints[0][2], raceCheckpoints[1][3], raceCheckpoints[1][4], raceCheckpoints[1][5], 7.0 );
		SendClientMessage(playerid, -1, "Checkpoint set!, Goodluck!");
	}
	return 1;

}

startRace1(playerid)
{
	new player2 = PlayerInfo[playerid][pPlayer2];
	if(IsPlayerInRace[pPlayer2])
	{
        IsPlayerInRace[player2] = 1;
    	playerCheckpoint[player2] = 0;
		SetPlayerRaceCheckpoint(player2, 0, raceCheckpoints[0][0], raceCheckpoints[0][1], raceCheckpoints[0][2], raceCheckpoints[1][3], raceCheckpoints[1][4], raceCheckpoints[1][5], 7.0 );
		SendClientMessage(player2, -1, "Checkpoint set!, Goodluck!");
	}
	return 1;

}

 

Posted (edited)
40 minutes ago, Sancky said:

no offense, but your script is a completely mess and doesn't have any logic. 

can you give me an example code for this topic? and ill try to fix my script.

 

 

Edited by JohnGTPS

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.