11.03.2014, 18:34
Greetings,
I am at the moment struggeling,
i have created the command "/savespos"
and i want it to save in my database,
I know i do not have the connection details included in the script yet, but that is not the problem,
The problem is the command prefix should be "Usage ; /savespos [Dname] [Dnote]"
If not including a [Dname] or a [Dnote] it should return with an error message these need to be filled in,
the only thing im struggeling with is the String, since i never used them before.
As of now i got this code:
Helping me with this would be a huge step ahead for me since i can see what i've done wrong,
also i will learn from this.
Im asking for your help if you know how to do this,
Kind regards.
I am at the moment struggeling,
i have created the command "/savespos"
and i want it to save in my database,
I know i do not have the connection details included in the script yet, but that is not the problem,
The problem is the command prefix should be "Usage ; /savespos [Dname] [Dnote]"
If not including a [Dname] or a [Dnote] it should return with an error message these need to be filled in,
the only thing im struggeling with is the String, since i never used them before.
As of now i got this code:
Код:
#include <a_samp> #include <a_mysql> #include <zcmd> #define FILTERSCRIPT /* Dynamic playerspawnpoint Creator thing Have to create dialog for the name have to create note for the note in the database. */ new query[256]; new Dname[128]; new Dnote[128]; public OnFilterScriptInit() { print("\n------Sa:Mp(0.3Z)----------------------"); print("---------spawnpoint----------------------"); print("-------V1.0 By Yvoms--------------------\n"); return 1; } COMMAND:Savespos(playerid, Params[]) { //if an administrator uses this command the prefix should be /savespos [Dname] [Dnote] //the Dname and the Dnote should be saved in the database along with the cords. new String0[128];//the Dname - should be stored in database as varchar new String1[128];//the Dnote - should be stored in database as varchar new Float:Pos[4]; GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]); GetPlayerFacingAngle(playerid, Pos[3]); format(query,sizeof(query),"INSERT INTO `SavedPos` (Dname,DynX,DynY,DynZ,DynA,Dnote) VALUES ('%s','%d','%f','%f','%f','%f')",string1,Pos[0],Pos[1],Pos[2],Pos[3],string0); mysql_query(query); return 1; }
also i will learn from this.
Im asking for your help if you know how to do this,
Kind regards.