SA-MP Forums Archive
Need help with OnPlayerExitVehicle - 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: Need help with OnPlayerExitVehicle (/showthread.php?tid=73734)



Need help with OnPlayerExitVehicle - vovz - 17.04.2009

Hello i can you tel me why this work.

Код:
if(strcmp(cmd,"/seatbelt",true)==0)
  {
  if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  {
	SendClientMessage(playerid,COLOR_GREY,"You are not in any vehicle");
  	return 1;
	}
  if(PlayerInfo[playerid][pSeatBelt] == 1)
  {
  	PlayerInfo[playerid][pSeatBelt] = 0;

	return 1;
	}
And this dont work
Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(PlayerInfo[playerid][pSeatBelt] == 1)
  {
  	PlayerInfo[playerid][pSeatBelt] = 0;
 
  	return 1;
	}
______________________________________
Full script
Код:
if(strcmp(cmd,"/seatbelt",true)==0)
  {
  if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  {
	SendClientMessage(playerid,COLOR_GREY,"You are not in any vehicle");
  	return 1;
	}
  if(PlayerInfo[playerid][pSeatBelt] == 1)
  {
  	PlayerInfo[playerid][pSeatBelt] = 0;
  GetPlayerName(playerid, sendername, sizeof(sendername));
  new stringtosee[255];
  new ftext[255];
  if(PlayerInfo[playerid][pSex] == 1) { ftext = "his"; }
  else if(PlayerInfo[playerid][pSex] == 1) { ftext = "her"; }
  format(stringtosee, sizeof(stringtosee), "* %s unbuckles %s seat belt", sendername , ftext);
  ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
  	return 1;
	}
	PlayerInfo[playerid][pSeatBelt] = 1;
  GetPlayerName(playerid, sendername, sizeof(sendername));
  new stringtosee[255];
  new ftext[255];
  if(PlayerInfo[playerid][pSex] == 1) { ftext = "his"; }
  else if(PlayerInfo[playerid][pSex] == 1) { ftext = "her"; }
  format(stringtosee, sizeof(stringtosee), "* %s buckles %s seat belt", sendername , ftext);
  ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
	return 1;
	}
And this is one who dont work
Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(PlayerInfo[playerid][pSeatBelt] == 1)
  {
  	PlayerInfo[playerid][pSeatBelt] = 0;
  new stringtosee[255];
  new sendername[MAX_PLAYER_NAME];
  GetPlayerName(playerid, sendername, sizeof(sendername));
  new ftext[255];
  if(PlayerInfo[playerid][pSex] == 1) { ftext = "his"; }
  else if(PlayerInfo[playerid][pSex] == 1) { ftext = "her"; }
  format(stringtosee, sizeof(stringtosee), "* %s unbuckles %s seat belt", sendername , ftext);
  ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
  	return 1;
	}
return 1;
}



Re: Need help with OnPlayerExitVehicle - linxx - 17.04.2009

for a start you are missing code is should go something like erm ... yea here you go this will work
Quote:
enum pInfo
{
pSeatBelt,
};
new PlayerInfo[MAX_PLAYERS][pInfo];


public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[playerid][pSeatBelt] = 0;
{

public OnPlayerExitVehicle(playerid, vehicleid)
{
if (GetPlayerState(playerid) == 1)
{
return 1;
}
if(gGas[playerid] == 0)
{
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~ Left car", 500, 3);
}
if(PlayerInfo[playerid][pSeatBelt] == 1)
{
PlayerInfo[playerid][pSeatBelt] = 0;
new stringtosee[255];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
new ftext[255];
if(PlayerInfo[playerid][pSex] == 1) { ftext = "his"; }
else if(PlayerInfo[playerid][pSex] == 1) { ftext = "her"; }
format(stringtosee, sizeof(stringtosee), "* %s unbuckles %s seat belt", sendername , ftext);
ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2 DAAA);
return 1;
}
return 1;
}

if(strcmp(cmd,"/belt",true)==0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
SendClientMessage(playerid,COLOR_GREY,"You are not in any vehicle");
return 1;
}
if(PlayerInfo[playerid][pSeatBelt] == 1)
{
PlayerInfo[playerid][pSeatBelt] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
new stringtosee[255];
new ftext[255];
if(PlayerInfo[playerid][pSex] == 1) { ftext = "his"; }
else if(PlayerInfo[playerid][pSex] == 1) { ftext = "her"; }
format(stringtosee, sizeof(stringtosee), "* %s unbuckles %s seat belt", sendername , ftext);
ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2 DAAA);
return 1;
}
PlayerInfo[playerid][pSeatBelt] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
new stringtosee[255];
new ftext[255];
if(PlayerInfo[playerid][pSex] == 1) { ftext = "his"; }
else if(PlayerInfo[playerid][pSex] == 1) { ftext = "her"; }
format(stringtosee, sizeof(stringtosee), "* %s buckles %s seat belt", sendername , ftext);
ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2 DAAA);
return 1;
}