Jump to content

DisablePlayerRaceCheckpoint to the player2


Recommended Posts

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;

}

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.