When player do /joinrace disable cmd /v -
[A]ndrei - 09.09.2012
hey how do you do this?
When player do /joinrace disable cmd /v
and when player does /exitrace it enables??
Also when player gets out of car how do you make it so it atomaticly exits the race?
Re: When player do /joinrace disable cmd /v -
[A]ndrei - 09.09.2012
can someone atleast tell me howto make it so when player gets out of car he leaves the race
please?
Re: When player do /joinrace disable cmd /v -
antonio112 - 09.09.2012
You'll have to create a new variable, which'll be true once the player joins race. Let me give you an example:
pawn Код:
new bool: pInRace[MAX_PLAYERS];
//Under OnPlayerConnect
pInRace[playerid] = false;
//Under OnPlayerDisconnect
pInRace[playerid] = false;
//In your /joinrace command
pInRace[playerid] = true;
//In your /v command
if(pInRace[playerid])
return SendClientMessage(playerid, -1, "You can't use this command when you're in a race.");
//In your /leaverace command
pInRace[playerid] = false;
And for the other problem, something like:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
{
if(pInRace[playerid])
{
pInRace[playerid] = false;
SendPlayerMessage(playerid, -1, "You left your vehicle and you've lost the race.");
//The rest of your code here, insert whatever you want.
return 1;
}
}
return 1;
}
[/pawn]
Re: When player do /joinrace disable cmd /v -
[A]ndrei - 09.09.2012
thx man but i decided i dont need to disable the v cmd so can you just make it when a player leaves the car he leaves the race
?thank you.
Re: When player do /joinrace disable cmd /v -
jameskmonger - 09.09.2012
OnPlayerExitVehicle
Put the contents of your exitrace command here
Re: When player do /joinrace disable cmd /v -
[A]ndrei - 10.09.2012
ok sorry i chould not have goten back to you fast but here you go.
pawn Код:
CMD:exitrace(playerid, params[])
{
if(Joined[playerid] == true)
{
JoinCount--;
Joined[playerid] = false;
DestroyVehicle(CreatedRaceVeh[playerid]);
DisablePlayerRaceCheckpoint(playerid);
TextDrawHideForPlayer(playerid, RaceInfo[playerid]);
CPProgess[playerid] = 0;
KillTimer(InfoTimer[playerid]);
TogglePlayerControllable(playerid, true);
SetCameraBehindPlayer(playerid);
#if defined RACE_IN_OTHER_WORLD
SetPlayerVirtualWorld(playerid, 0);
#endif
} else return SendClientMessage(playerid, RED, "<!> You are not in a race!");
return 1;
}
Re: When player do /joinrace disable cmd /v -
[A]ndrei - 11.09.2012
anyone help me?
Re: When player do /joinrace disable cmd /v -
[HK]Ryder[AN] - 11.09.2012
Here u go
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(Joined[playerid] == true)
{
JoinCount--;
Joined[playerid] = false;
DestroyVehicle(CreatedRaceVeh[playerid]);
DisablePlayerRaceCheckpoint(playerid);
TextDrawHideForPlayer(playerid, RaceInfo[playerid]);
CPProgess[playerid] = 0;
KillTimer(InfoTimer[playerid]);
TogglePlayerControllable(playerid, true);
SetCameraBehindPlayer(playerid);
#if defined RACE_IN_OTHER_WORLD
SetPlayerVirtualWorld(playerid, 0);
#endif
SendClientMessage(playerid, -1, "You left your vehicle and lost the race <!>");
}
return 1;
}
gimme a rep if this works. Not Tested.
Re: When player do /joinrace disable cmd /v -
[A]ndrei - 11.09.2012
nope not working
Re: When player do /joinrace disable cmd /v -
Guitar - 11.09.2012
One question, why did you use "bool"? And can you do it without "bool"?