problem with onplayerstatechange
#1


#endif
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new string[128];
	new plname[24];
	new plveh = GetPlayerVehicleID(playerid);

		 switch(newstate) {
			case PLAYER_STATE_ONFOOT: {
				switch(oldstate) {
					case PLAYER_STATE_DRIVER: OnPlayerExitVehicle(playerid,255);
					case PLAYER_STATE_PASSENGER: OnPlayerExitVehicle(playerid,255);
				}
			}
		}
		return 1;
	}
	
	if(newstate == PLAYER_STATE_DRIVER)
 		{
		if(plveh == Vehname[0])
			{
			GetPlayerName(playerid, plname, 24);
   			if(strcmp(PlayerName, "dlegend", true) == 0)
      		{
      			SendPlayerFormattedText(playerid, 0xFFFF00AA,"Welcome to your Car dlegend");
      		}
      		else
      		{

						format(string, sizeof(string), "** Alarm bip bip bip **");
    				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				SendPlayerFormattedText(playerid, 0xFFFF00AA, "This car is for dlegend only ! ! !");
				RemovePlayerFromVehicle(playerid);
			}
		}
	//	else if(plveh == Vehname[1])
	//	{
			///////// code here same as above only with a different name in place of yours
	//	}
		return 1;
	}
	return 1;

#endif
dont see wats rong with it
Reply
#2

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new PlayerName[24];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

  if(newstate == PLAYER_STATE_DRIVER)
  {
   new Vehicle = GetPlayerVehicleID(playerid);
   if(Vehicle == dlegend)
   {
     if(strcmp(PlayerName,"dlegend",true))
     {
      RemovePlayerFromVehicle(playerid);
      SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for dlegend");
     }
   }
  }

		switch(newstate) {
			case PLAYER_STATE_ONFOOT: {
				switch(oldstate) {
					case PLAYER_STATE_DRIVER: OnPlayerExitVehicle(playerid,255);
					case PLAYER_STATE_PASSENGER: OnPlayerExitVehicle(playerid,255);
				}
			}
		}
    }
  return 1;
}

#endif
the proplem is on that last return
Desktop\pTc 0.3x offical\gamemodes\pTc0.1x.pwn(9785) : error 010: invalid function or declaration
Reply
#3

Quote:
Originally Posted by dlegend
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new PlayerName[24];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

  if(newstate == PLAYER_STATE_DRIVER)
  {
   new Vehicle = GetPlayerVehicleID(playerid);
   if(Vehicle == dlegend)
   {
     if(strcmp(PlayerName,"dlegend",true))
     {
      RemovePlayerFromVehicle(playerid);
      SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for dlegend");
     }
   }
  }

		switch(newstate) {
			case PLAYER_STATE_ONFOOT: {
				switch(oldstate) {
					case PLAYER_STATE_DRIVER: OnPlayerExitVehicle(playerid,255);
					case PLAYER_STATE_PASSENGER: OnPlayerExitVehicle(playerid,255);
				}
			}
		}
   }
  return 1;
}

#endif
the proplem is on that last return
Desktop\pTc 0.3x offical\gamemodes\pTc0.1x.pwn(9785) : error 010: invalid function or declaration
Is the error on his line?

if(strcmp(PlayerName,"dlegend",true))
Reply
#4

its sorted now thanks anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)