SA-MP Forums Archive
help - 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)
+--- Thread: help (/showthread.php?tid=574544)



Vehicle Owner Name Problem! - danger01 - 18.05.2015

i have problem with vehicle system i am using satdm_v9 and when i bought car and call it it says my name but after like 30 min or left from game it bugs to id 0. Vehicle owner name is getting name of id 0. and i saw usually id 0 players are non registered.

this public for show owner name idk its problem with this.

Code:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
//------------------------------------------------------------------------------
	passenger[playerid] = ispassenger;
	if (GetPlayerSurfingVehicleID(playerid) == vehicleid)
	{
		ClearAnimations(playerid);
	}
	if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 592 && ispassenger == 1)
	{
		SetPlayerInterior(playerid,9);
		SetPlayerFacingAngle(playerid,0.0);
		SetPlayerPos(playerid, 315.856170,1024.496459,1949.797363);
		SetCameraBehindPlayer(playerid);
		InAndrom[playerid]=vehicleid;
	}
	if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 519 && ispassenger)
	{
		if (!ShamalExists(vehicleid))
		{
			CreateShamalInt(vehicleid, float(randomEx(3000)), float(randomEx(3000)), float(random(100)+800));
		}
		SetPlayerPosInShamal(playerid, vehicleid);
		InShamal[playerid] = vehicleid;
	}
	#if defined ENABLE_SPEC
	for(new xp=0; xp<MAX_PLAYERS; xp++) {
	    if(GetPlayerState(xp) == PLAYER_STATE_SPECTATING && PlayerInfo[xp][SpecID] == playerid) {
	        TogglePlayerSpectating(xp, 1);
	        PlayerSpectateVehicle(xp, vehicleid);
	        PlayerInfo[xp][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
		}
	}
	#endif
	if(onsys[vehicleid] == 1) {
		if(passenger[playerid] == 0) {
			if(PlayerInfo[playerid][LoggedIn] == 1) {
				if (strcmp(VehicleInfo[vehicleid][owner],PlayerInfo[playerid][name],false) == 0) {
					new string[128];
					format(string, sizeof(string), "Welcome to your %s %s, please drive carefully!", VehicleInfo[vehicleid][name], PlayerInfo[playerid][name]);
					GameTextForPlayer(playerid, string, 3000, 4);
					SendMessageToPlayer(playerid, green, string);
					return 1;}
				if (strcmp(VehicleInfo[vehicleid][owner],DEFAULT_OWNER,false) == 0) {
					if(VehicleInfo[vehicleid][buybar] == 1) {
						new string[128];
						format(string,sizeof(string),"This %s has been set as non-buyable by server administration!", VehicleInfo[vehicleid][name]);
						GameTextForPlayer(playerid, string, 3000, 4);
						SendMessageToPlayer(playerid, COLOR_BRIGHTRED, string);
						return 1;}
					new string[128];
					format(string, sizeof(string), "This %s is for sale and costs $%d, type /vmenu to see vehicle options.",VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][vehiclecost]);
					GameTextForPlayer(playerid, string, 3000, 4);
					SendMessageToPlayer(playerid, COLOR_YELLOW, string);
					return 1;}
				else {
					new string[128];
					format(string, sizeof(string), "This %s belongs to %s, and cannot be purchased.", VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][owner]);
					GameTextForPlayer(playerid, string, 3000, 4);
					SendMessageToPlayer(playerid, COLOR_BRIGHTRED, string);
					return 1;}}
			else {
			    new playername[128];
			    GetPlayerName(playerid,playername,sizeof(playername));
			    if (strcmp(VehicleInfo[vehicleid][owner],playername,false) == 0) {
					new string[128];
					format(string, sizeof(string), "Welcome to your %s %s, please drive carefully! ~n~Remember, you must be logged in to acces vehicle controls.", VehicleInfo[vehicleid][name], playername);
					return GameTextForPlayer(playerid, string, 3000, 4);}
		       	if (strcmp(VehicleInfo[vehicleid][owner],DEFAULT_OWNER,false) == 0) {
					if(VehicleInfo[vehicleid][buybar] == 1) {
		           		new string[128];
			        	format(string,sizeof(string),"This %s has been set as non-buyable by server administration!", VehicleInfo[vehicleid][name]);
			        	return GameTextForPlayer(playerid, string, 3000, 4);}
				   	new string[128];
		   	       	format(string, sizeof(string), "This %s is for sale and costs $%d, ~n~You must be logged in to purchase a vehicle.",VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][vehiclecost]);
		   	       	return GameTextForPlayer(playerid, string, 3000, 4);}
				else {
		        	new string[128];
		          	format(string, sizeof(string), "This %s belongs to %s, and cannot be purchased.", VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][owner]);
		          	return GameTextForPlayer(playerid, string, 3000, 4);}}}}
	return 1;
}



Re: help - Bingo - 18.05.2015

Did you try to respawn all the vehicles? Usually this happens in SATDM cars owner names are changed, Just try to respawn all the cars if still NOTHING then do a hard manual reset not the /vmenu one manually through scriptfiles.


Re: help - danger01 - 18.05.2015

i tried reset all vehicles too. it is still changing vehicle owner names. i need fix it. is there way to fix it?


Re: help - danger01 - 18.05.2015

Can someone help me?