SA-MP Forums Archive
Need help! [VERY IMPORTANT] [INGAME PAWN SCRIPTING] - 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: Need help! [VERY IMPORTANT] [INGAME PAWN SCRIPTING] (/showthread.php?tid=299410)



Need help! [VERY IMPORTANT] [INGAME PAWN SCRIPTING] - fiki574 - 25.11.2011

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!


Re: Need help! [VERY IMPORTANT] [INGAME PAWN SCRIPTING] - IceCube! - 25.11.2011

... 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!


Re: Need help! [VERY IMPORTANT] [INGAME PAWN SCRIPTING] - Sascha - 25.11.2011

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);



Re: Need help! [VERY IMPORTANT] [INGAME PAWN SCRIPTING] - System64 - 25.11.2011

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!


Re: Need help! [VERY IMPORTANT] [INGAME PAWN SCRIPTING] - fiki574 - 25.11.2011

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


Re: Need help! [VERY IMPORTANT] [INGAME PAWN SCRIPTING] - Marco_Valentine - 25.11.2011

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


Re: Need help! [VERY IMPORTANT] [INGAME PAWN SCRIPTING] - iPLEOMAX - 26.11.2011

Execute PAWN Functions In-Game by RyDeR`