03.07.2006, 10:38
I have done something similar to something someone has done before. But I just change it a little bit that the vehicle gets into your front using sine and cosine. This is how a mathematician does things!
Code:
if (strcmp(cmdtext, "/purchase", true)==0) // to set the vehicle that you register to be teleported { if (GetPlayerMoney(playerid) < 5000) { SendClientMessage(playerid,YELLOW,"Sorry, you don't have enough money to buy a car."); } else { if (IsPlayerInAnyVehicle(playerid) == 1) { SetVehicleToRespawn(ownedcar[playerid]); ownedcar[playerid] = GetPlayerVehicleID(playerid); owner[ownedcar[playerid]] = playerid; SendClientMessage(playerid,YELLOW,"Congragulations! You have purchased a new car."); GivePlayerMoney(playerid,-5000); } else { SendClientMessage(playerid,YELLOW,"Please get in a vehicle to buy it."); } } return 1; } if (strcmp(cmdtext, "/callmycar", true)==0) { if (ownedcar[playerid] != 0) { if (GetPlayerMoney(playerid) < 500) { SendClientMessage(playerid,YELLOW,"Sorry, you don't have enough money to use the car teleport service."); } else { new Float:playerpos[4]; GetPlayerPos(playerid,playerpos[0],playerpos[1],playerpos[2]); GetPlayerFacingAngle(playerid,playerpos[3]); SetVehicleZAngle(ownedcar[playerid],playerpos[3]+90.0); SetVehiclePos(ownedcar[playerid],playerpos[0]+3.0*floatsin(-playerpos[3],degrees),playerpos[1]+3.0*floatcos(-playerpos[3],degrees),playerpos[2]+0.5); // This one is cool that I am using trigo functions to set the vehicle just before you. SendClientMessage(playerid,YELLOW,"Thank you for using car teleport service. Your car has came."); GivePlayerMoney(playerid,-500); } } return 1; }