SA-MP Forums Archive
XMAS Car problem! - 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: XMAS Car problem! (/showthread.php?tid=552085)



XMAS Car problem! - cnoopers - 22.12.2014

Car is doesn't deleting after repeat the command.
'X-MAS' text is invisible.
Where is problem in this two things?
Код:
CMD:car(playerid, params[])
{
	new car[MAX_PLAYERS];
	DestroyVehicle(car[playerid]);
	new Float:x, Float:y, Float:z, Float:angle;
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, angle);
	car[playerid] = CreateVehicle(562, x, y, z, angle, 3, 3, -1);
	new xmasobject = CreateObject(19329,0,0,-1000,0,0,0,100);
	AttachObjectToVehicle(xmasobject, GetPlayerVehicleID(playerid), 0.000000,-2.325000,0.150000,-8.100000,0.000000,0.000000);
    SetObjectMaterialText(xmasobject, "X-MAS", 0, 130, "Arial", 30, 0, -1, 0, 1);
	PutPlayerInVehicle(playerid, car[playerid], 0);
	return 1;
}



Re: XMAS Car problem! - Jstylezzz - 22.12.2014

You declare the 'car' variable inside the command, which, I think, causes the variable to be set to 0 or something, which is the reason for the old car not being deleted.
Remove the 'new car[MAX_PLAYERS];' from the command, and place it outside any callbacks in your script, if it doesn't already exist.
About the text being invisible, maybe the material index in the SetObjectMaterialText is wrong? It's the '0' after "X-MAS', try changing that. Not sure about this one though.


Re: XMAS Car problem! - cnoopers - 22.12.2014

Okay spawning works.
This '0' in text is a index so it is correct. Everything should be good in line with material, I made it in editor.

EDIT:
SOLVED! I changed GetPlayerVehicleID to car[playerid] and works good!