Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/lol", true))
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- GetXYInSideOfPlayer(playerid, x, y, 5.0, false);
- SetPlayerCameraPos(playerid, x, y, z);
- GetPlayerPos(playerid, x, y, z);
- SetPlayerCameraLookAt(playerid, x, y, z);
- return 1;
- }
- if(!strcmp(cmdtext, "/behind", true))
- {
- SetCameraBehindPlayer(playerid);
- return 1;
- }
- return 0;
- }
- stock GetXYInSideOfPlayer(playerid, &Float:x, &Float:y, Float:distance, bool:left=false)
- {
- new Float:a;
- GetPlayerPos(playerid, x, y, a);
- GetPlayerFacingAngle(playerid, a);
- if(IsPlayerInAnyVehicle(playerid))
- GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
- a += 90.0;
- if(left)
- {
- x += (distance * floatsin(-a, degrees));
- y += (distance * floatcos(-a, degrees));
- } else {
- x -= (distance * floatsin(-a, degrees));
- y -= (distance * floatcos(-a, degrees));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement