Need help! [VERY IMPORTANT] [INGAME PAWN SCRIPTING]
#1

Ok, so I am on one project a while, and thats ingame PAWN scripter & teleport creator! (yes, you will be able to create scripts from ingame)
I dont have problems with creating functions through dialogs, but with creating teleports I have one f***ing annoying problem!
Код:
new Float:Xp;
new Float:Yp;
new Float:Zp;
new Float:Angle;
GetPlayerPos(playerid,Xp,Yp,Zp);
GetPlayerFacingAngle(playerid,Angle);
new Tele[1000];
new TelePawn[1000];
format(Tele,sizeof(Tele),"\n\npublic OnPlayerCommandText(playerid, cmdtext[])\n{\n\tif(strcmp(/tele, cmdtext, true, 10) == 0)//add apostrophes to tele\n\t{\n\t\tSetPlayerPos(playerid,%d);\n\t\tSetPlayerFacingAngle(playerid,%d);\n\t\tSetCameraBehindPlayer(playerid);\n\t\treturn 1;\n\t}\n\treturn 0;\n}", GetPlayerPos(playerid,Xp,Yp,Zp), GetPlayerFacingAngle(playerid,Angle));
format(TelePawn,sizeof(TelePawn),"script.pwn");
new File: PwnFile;
PwnFile = fopen(TelePawn,io_append);
fwrite(PwnFile,Tele);
fclose(PwnFile);
And this is what it generates:
Код:
SetPlayerPos(playerid,1,1,0);
SetPlayerFacingAngle(playerid,1);
Should generate right coords, but always generates this! Please help me, cant continue my project until this is fixed!
Reply
#2

... YOu cant script PAWN ingame... Unless you save values to files and load them into their code...

YOur problem is your trying to load varibales from code wont work!

Dont put the code again put Xp, Yp, Zp,

Also if you want to code ingame do it through loading data into the pawn file not creating a whole new one that needs to be compiled by a plugin you have to make!
Reply
#3

pawn Код:
format(Tele,sizeof(Tele),"\n\npublic OnPlayerCommandText(playerid, cmdtext[])\n{\n\tif(strcmp(/tele, cmdtext, true, 10) == 0)//add apostrophes to tele\n\t{\n\t\tSetPlayerPos(playerid,%f, %f, %f);\n\t\tSetPlayerFacingAngle(playerid,%f);\n\t\tSetCameraBehindPlayer(playerid);\n\t\treturn 1;\n\t}\n\treturn 0;\n}", Xp, Yp, Zp, Angle);
Reply
#4

loooool ofcourse you get that, you must add %f isntead of ex. Anagle and than after "" add Angle 'cause Angle variable
is by default on 1

Edit: Sachsa did that!
Reply
#5

Quote:
Originally Posted by IceCube!
Посмотреть сообщение
... YOu cant script PAWN ingame... Unless you save values to files and load them into their code...

YOur problem is your trying to load varibales from code wont work!

Dont put the code again put Xp, Yp, Zp,

Also if you want to code ingame do it through loading data into the pawn file not creating a whole new one that needs to be compiled by a plugin you have to make!
Yes, I can script ingame! Thats my project! Read the text better!

Quote:
Originally Posted by Sascha
Посмотреть сообщение
pawn Код:
format(Tele,sizeof(Tele),"\n\npublic OnPlayerCommandText(playerid, cmdtext[])\n{\n\tif(strcmp(/tele, cmdtext, true, 10) == 0)//add apostrophes to tele\n\t{\n\t\tSetPlayerPos(playerid,%f, %f, %f);\n\t\tSetPlayerFacingAngle(playerid,%f);\n\t\tSetCameraBehindPlayer(playerid);\n\t\treturn 1;\n\t}\n\treturn 0;\n}", Xp, Yp, Zp, Angle);
Oh, lol stupid me! Tnx! :P
Reply
#6

pawn Код:
new Float:Pos[MAX_PLAYERS][4];

GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
GetPlayerFacingAngle(playerid,Pos[playerid][3]);
format(Tele,256,"Coordinates succesfully defined: %.4f,%.4f,%.4f ",Pos[playerid][0],Pos[playerid][1],Pos[playerid][2],Pos[playerid][3]);
new File: PwnFile;
PwnFile = fopen(TelePawn,io_append);
fwrite(PwnFile,Tele);
fclose(PwnFile);
Credits to Nolo
https://sampforum.blast.hk/showthread.php?tid=53583
Reply
#7

Execute PAWN Functions In-Game by RyDeR`
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)