23.01.2012, 14:47
Can anyone help me, I downloaded the FS but he has a problem. He does not save the "SetPlayerCameraPos."
Someone get help?
thank you
Someone get help?
thank you
pawn Код:
/*
Developer : [iPs]Knife
Other Credits : [iPs]TeaM
Dont revome the credits
'___ ____ ___ _______
| _| (_)| _ \ ___ |_ | |__ __|___ ___ _ __ ___
| | | || |_) |/ __| | | | | / _ \ / \ | '_ ` _ \
| |_ | || __/ \__ \ _| | | | | __/ / /_\ \ | | | | | |
|___| |_||_| |___/ |___| |_| \___|/ /---\_\|_| |_| |_|
*/
// Includes Utilizadas !
#include <a_samp>
// Novas Criaзхes !
new Float:CameraValor[6];
new Float:Valor;
new SearchPosition[MAX_PLAYERS];
new PressionoSeila[MAX_PLAYERS];
// Definiзхes Usadas !
#define ESPACO 8
#define VERMELHOCLARO 0xFF8080FF
// Comandos Usados
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/camsave", true) == 0)
{
SendClientMessage(playerid,0xFFFFFFAA,"[iPs]TeaM Editor Camera.");
new EURI[128];
new File:NEMRI;
format(EURI, sizeof(EURI), "SetPlayerCameraPos(playerid,%.3f,%.3f,%.3f);",CameraValor[0],CameraValor[1],CameraValor[2]);
SendClientMessage(playerid,0xFFFFFFAA,EURI);
format(EURI, sizeof(EURI), "SetPlayerCameraLookAt(playerid,%.3f,%.3f,%.3f);",CameraValor[3],CameraValor[4],CameraValor[5]);
SendClientMessage(playerid,0xFFFFFFAA,EURI);
NEMRI = fopen("Cameras Save.txt", io_append);
fwrite(NEMRI, EURI);
fclose(NEMRI);
return 1;
}
if(strcmp(cmd, "/commands", true) == 0)
{
SendClientMessage(playerid,0xFFFFFFAA,"[iPs]TeaM Camera Editor.");
SendClientMessage(playerid,VERMELHOCLARO,"Commands : /setcamera /close /camsave /camerahelp /changerot.");
return 1;
}
if(strcmp(cmd, "/setcamera", true) == 0)
{
SearchPosition[playerid] = 1;
PressionoSeila[playerid] = 0;
SendClientMessage(playerid,0xFFFFFFAA,"[iPs]TeaM Editor Camera.");
SendClientMessage(playerid,VERMELHOCLARO,"If you need any command to help you use /camerahelp");
TogglePlayerControllable(playerid,0);
Valor = 0.1;
GetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
GetPlayerPos(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
return 1;
}
if(strcmp(cmd, "/camerahelp", true) == 0)
{
SendClientMessage(playerid,0xFFFFFFAA,"[iPs]TeaM Camera Editor.");
SendClientMessage(playerid,VERMELHOCLARO,"KEY_FIRE += X, KEY_DOWN += Y, Space += Z");
SendClientMessage(playerid,VERMELHOCLARO,"F -= X, ALTGR -= Y, Caps-Lock -= Z");
return 1;
}
if(strcmp(cmd, "/changerot", true) == 0)
{
if(PressionoSeila[playerid] == 0)
{
PressionoSeila[playerid] = 1;
SendClientMessage(playerid,0xFFFFFFAA,"[iPs]TeaM Editor Camera.");
SendClientMessage(playerid,VERMELHOCLARO,"Your rotation was changed to be more far !");
}
if(PressionoSeila[playerid] == 1)
{
PressionoSeila[playerid] = 0;
SendClientMessage(playerid,0xFFFFFFAA,"[iPs]TeaM Editor Camera.");
SendClientMessage(playerid,VERMELHOCLARO,"Your Rotation has to be Changed Near !");
}
return 1;
}
if(strcmp(cmd, "/close", true) == 0)
{
TogglePlayerControllable(playerid,1);
SetCameraBehindPlayer(playerid);
SearchPosition[playerid] = 0;
PressionoSeila[playerid] = 0;
SendClientMessage(playerid,0xFFFFFFAA,"[iPs]TeaM Editor Camera.");
SendClientMessage(playerid,0xFFFFFFAA,"For Save Camera Positions Use /camsave");
return 1;
}
return 0;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_FIRE)
{
if(SearchPosition[playerid] == 1)
{
CameraValor[0] += Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
else if(PressionoSeila[playerid] == 1)
{
CameraValor[3] += Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
}
if(newkeys == 16)
{
if(SearchPosition[playerid] == 1)
{
CameraValor[0] -= Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
else if(PressionoSeila[playerid] == 1)
{
CameraValor[3] -= Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
}
if(newkeys == KEY_DOWN)
{
if(SearchPosition[playerid] == 1)
{
CameraValor[1] += Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
else if(PressionoSeila[playerid] == 1)
{
CameraValor[4] += Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
}
if(newkeys == 4)
{
if(SearchPosition[playerid] == 1)
{
CameraValor[1] -= Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
else if(PressionoSeila[playerid] == 1)
{
CameraValor[4] -= Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
}
if(newkeys == ESPACO)
{
if(SearchPosition[playerid] == 1)
{
CameraValor[2] += Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
else if(PressionoSeila[playerid] == 1)
{
CameraValor[5] += Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
}
if(newkeys == 128)
{
if(SearchPosition[playerid] == 1)
{
CameraValor[2] -= Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
else if(PressionoSeila[playerid] == 1)
{
CameraValor[5] -= Valor;
SetPlayerCameraPos(playerid,CameraValor[0],CameraValor[1],CameraValor[2]);
SetPlayerCameraLookAt(playerid,CameraValor[3],CameraValor[4],CameraValor[5]);
}
}
return 1;
}
// Stockґs para deixar o FS com mais linhas (:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' ')) { index++; }
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}