SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/06/2013, 07:40 PM   #1
Don_Cage
High-roller
 
Don_Cage's Avatar
 
Join Date: Aug 2012
Posts: 1,072
Reputation: 40
Default Camera problem

This is the code
pawn Code:
if(strcmp(cmd, "/camera", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid))
            {
                if(!IsPlayerInRangeOfPoint(playerid, 8,211.6222,1811.9565,21.8594))
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not at the Area51 Security Panel !");
                    return 1;
                }
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /camera [number 1 - 6]  (6 = OFF)");
                    return 1;
                }
                new number = strval(tmp);
                if(number < 1 || number > 6) { SendClientMessage(playerid, COLOR_GREY, "   Camera Number can't be below 1 or above 6 !"); return 1; }
                TogglePlayerControllable(playerid, 0);
                GetPlayerPos(playerid, Unspec[playerid][Coords][0],Unspec[playerid][Coords][1],Unspec[playerid][Coords][2]);
                if(number == 1) { SetPlayerCameraPos(playerid, 118.1011,1931.3221,22.5527); SetPlayerCameraLookAt(playerid, 98.9656,1920.9819,18.2180); }
                else if(number == 2) { SetPlayerCameraPos(playerid, 213.5340,1875.3075,17.6406); SetPlayerCameraLookAt(playerid, 213.8679,1884.1714,13.8945); }
                else if(number == 3) { SetPlayerCameraPos(playerid, 266.0640,1894.8856,38.6459); SetPlayerCameraLookAt(playerid, 224.0039,1887.1532,17.6406); }
                else if(number == 4) { SetPlayerCameraPos(playerid, 260.8112,1808.0175,38.6303); SetPlayerCameraLookAt(playerid, 227.5645,1818.4778,17.6406); }
                else if(number == 5) { SetPlayerCameraPos(playerid, 114.5196,1814.3483,38.6029); SetPlayerCameraLookAt(playerid, 123.6176,1846.4792,17.6549); }
                else if(number == 6)
                {
                    MedicBill[playerid] = 0;
                    TogglePlayerControllable(playerid, 1);
                    SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], Unspec[playerid][Coords][0], Unspec[playerid][Coords][1], Unspec[playerid][Coords][2], 10.0, -1, -1, -1, -1, -1, -1);
                    SpawnPlayer(playerid);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not a Cop / Soldier !");
                return 1;
            }
        }
        return 1;
    }
But when I want to end the cam (/camera 6) It spawns the player where he login. How to fix this?
Don_Cage is offline   Reply With Quote
Old 15/06/2013, 08:12 PM   #2
WillyP
High-roller
 
WillyP's Avatar
 
Join Date: Jul 2010
Location: England
Posts: 2,027
Reputation: 63
Default Re: Camera problem

There's no SetPlayerCameraPos for 6, it just leads into the SetSpawnInfo and then SpawnPlayer, hence why the player is spawning rather than having their cam pos set.
__________________
once average now terrible
WillyP is offline   Reply With Quote
Old 16/06/2013, 11:05 PM   #3
Don_Cage
High-roller
 
Don_Cage's Avatar
 
Join Date: Aug 2012
Posts: 1,072
Reputation: 40
Default Re: Camera problem

Thats how I want it. the 6th will end the camera. But you spawn where you login not where you typed /camera
Don_Cage is offline   Reply With Quote
Old 17/06/2013, 12:17 AM   #4
park4bmx
High-roller
 
park4bmx's Avatar
 
Join Date: Dec 2009
Location: Samokov,Bulgaria
Posts: 2,364
Reputation: 240
Default Re: Camera problem

Just use SetPlayerPos
No need to go through all that
park4bmx is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Camera Problem -=Dar[K]Lord=- Scripting Help 4 25/04/2013 03:01 PM
Camera Problem Tigerkiller Scripting Help 2 22/06/2012 12:28 AM
Camera problem. x96664 Server Support 4 19/05/2012 01:23 PM
Problem With Camera Immortal_LTU Scripting Help 3 31/12/2011 07:31 PM
Camera Problem Amoken Help Archive 2 08/04/2009 07:48 PM


All times are GMT. The time now is 08:27 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.