Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new RoadBlock[MAX_PLAYERS];
- new RoadBlockObject[MAX_PLAYERS];
- GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) // Add somewhere
- {
- new Float:a;
- GetPlayerPos(playerid, x, y, a);
- GetPlayerFacingAngle(playerid, a);
- if (GetPlayerVehicleID(playerid))
- {
- GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
- }
- x += (distance * floatsin(-a, degrees));
- y += (distance * floatcos(-a, degrees));
- return 1;
- }
- COMMAND:rb(playerid,params[])
- {
- new vehicleid= GetPlayerVehicleID(playerid);
- if(!IsPlayerInVehicle(playerid, vehicleid))
- {
- if(RoadBlock[playerid] == 0)
- {
- new Float:X, Float:Y, Float:Z,Float:Angle;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, Angle);
- GetXYInFrontOfPlayer(playerid, X, Y, 1.5); // 1.5 Units in front of the player
- RoadBlockObject[playerid] = CreateObject(979, X, Y, Z-0.3, 0, 0, Angle);
- RoadBlock[playerid] = 1;
- SendClientMessage(playerid, COLOR_GREEN, "You placed the RoadBlock!");
- }
- else SendClientMessage(playerid, COLOR_RED, "ERROR: You already placed a RoadBlock!");
- }
- else SendClientMessage(playerid, COLOR_RED, "You can not place a RoadBlock while in a Vehicle!");
- }
- COMMAND:drb(playerid,params[])
- {
- if(RoadBlock[playerid] == 0)
- {
- SendClientMessage(playerid, COLOR_RED, "You did not place a RoadBlock!");
- return 1;
- }
- RoadBlock[playerid] = 0;
- DestroyObject(RoadBlockObject[playerid]);
- SendClientMessage(playerid, COLOR_GREEN, "You removed the RoadBlock!");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment