Change cameras - 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: Change cameras (
/showthread.php?tid=366705)
Change cameras -
Qur - 07.08.2012
Hey.. I've been working on a security cameras.. but right now I want to make it that you'll be able to change cameras by using your arrows..
and I dont know how to do it actually..
I have only the command for the cams..
Re: Change cameras -
Wesley221 - 07.08.2012
You can use this function for it:
https://sampwiki.blast.hk/wiki/GetPlayerKeys
Re: Change cameras -
Qur - 07.08.2012
Yea I know how to make it.. but not perfectly.. I mean.. if the player press lets say key left so it moves left.. but I should use something smarter like rands..?
I just need someone to give me small example or just small explation about it..
Re: Change cameras -
Wesley221 - 07.08.2012
You said you got the commands for the cameras to change. Then detect whenever the player press his left button to execute all the codes when you go a camera to the left.
Like:
pawn Код:
if( keys == left ) // THIS IS NOT HOW IT SHOULD BE DONE, just follow the page ive sended above
{
// paste here all the stuff when you want the camera go to the left
}
The same should go with right
Re: Change cameras -
Qur - 07.08.2012
something like
pawn Код:
if(newkeys == KEY_LEFT)
{
return OnPlayerCommandText(playerid, "/security");
}
?
Re: Change cameras -
Wesley221 - 07.08.2012
If KEY_LEFT is for the left arrow, then yes.
Re: Change cameras -
Qur - 07.08.2012
I was trying this:
pawn Код:
if(newkeys == KEY_LEFT)
{
if(Security[playerid] == 1)
{
SetPlayerCameraPos(playerid, 1791.2063, -1523.6543, 5702.2305);
SetPlayerCameraLookAt(playerid, 1792.1201, -1523.2572, 5701.9629);
Security[playerid] = 2;
}
if(Security[playerid] == 2)
{
SetPlayerCameraPos(playerid, 1814.1965, -1549.2343, 5702.0610);
SetPlayerCameraLookAt(playerid, 1813.2019, -1549.1788, 5701.8076);
Security[playerid] = 3;
}
}
if(strcmp(cmd, "/secon", true) == 0)
{
if (PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (PlayerToPoint(0.7,playerid,1802.8545,-1538.0780,5700.4287))
{
Security[playerid] = 1;
TogglePlayerControllable(playerid, 0);
SetPlayerCameraLookAt(playerid, 1813.2711, -1514.7656, 5701.9863);
SetPlayerCameraPos(playerid, 1814.1455, -1514.2896, 5702.1807);
return 1;
}
}
}
}
not really working.. ;/
am i missing something?