24.10.2010, 13:59
(
Последний раз редактировалось willsuckformoney; 29.10.2010 в 12:09.
)
OK I have this command here:
It all works but the problem is, it wont save the CP name it just saves as
= CreateDynamicCP(PX,PY,PZ,3,-1,-1,-1,100.0);
Its missing the name at the beginning. Anyone know why?
pawn Код:
dcmd_cp(playerid,params[])
{
if(IsPlayerAdmin(playerid)) {
new cpName, tmp[256], Index;
tmp = strtok(params,Index),cpName = strval(tmp);
new Float:X,Float:Y,Float:Z,string[128];
GetPlayerPos(playerid,X,Y,Z);
if(strlen(params))
{
CreateDynamicCP(X,Y,Z,3,-1,-1,-1,100.0);
format(string,sizeof(string),"new %s = CreateDynamicCP(%0.1f,%0.1f,%0.1f,3,-1,-1,-1,100.0);",cpName,X,Y,Z);
SaveToFile("CheckPoints",string);
format(string,sizeof(string),"Dynamic CheckPoint Created! X = %0.1f, Y = %0.1f, Z = %0.1f, Name = %s",X,Y,Z,cpName);
SendClientMessageToAll(MSGSUCC_COLOR,string);
} else return SendClientMessage(playerid,red,"USAGE: /CP [CP Name]");
} else return SendERROR(playerid,1);
return 1;
}
//
forward SaveToFile(filename[],text[]);
public SaveToFile(filename[],text[])
{
new File:FAdmin, filepath[256], string[256];
format(filepath,sizeof(filepath),"CNR/logs/%s.txt",filename);
FAdmin = fopen(filepath,io_append);
format(string,sizeof(string),"%s\r\n",text);
fwrite(FAdmin,string);
fclose(FAdmin);
return 1;
}
= CreateDynamicCP(PX,PY,PZ,3,-1,-1,-1,100.0);
Its missing the name at the beginning. Anyone know why?