Need help with OnPlayerExitVehicle
#1

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;
}
Reply
#2

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)