29.01.2011, 10:29
Can someone make me a command for example /label -text- ? and when player types again, server updates 3d label text.. please.. i would be thankful..
// This is a comment
// uncomment the line below if you want to write a filterscript
#include <a_samp>
#include <sscanf>
#define FILTERSCRIPT
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Labels by Dark_Clown");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
forward SaveToLog(filename[],text[]);
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(addlabel,8,cmdtext);
return 0;
}
dcmd_addlabel(playerid,params[])
{
new string[160],Float: X, Float: Y, Float: Z,text[100],distance;
GetPlayerPos(playerid, X,Y,Z);
if(sscanf(params,"sd",text,distance)) return SendClientMessage(playerid,0xFB9204FF,"USAGE: /addlabel [text][distance]");
Create3DTextLabel(text,0x03B8FCFF,X,Y,Z,distance,GetPlayerVirtualWorld(playerid));
format(string,sizeof(string),"Create3DTextLabel(\"%s\",0x03B8FCFF,%f, %f, %f,%d,%d);",text,X,Y,Z,distance,GetPlayerVirtualWorld(playerid));
SaveToLog("labels",string);
return 1;
}
public SaveToLog(filename[],text[])
{
new File:ffile;
new filepath[128];
new string[128];
format(filepath,sizeof(filepath),"%s.txt",filename);
ffile = fopen(filepath,io_append);
format(string,sizeof(string)," %s\r\n",text);
fwrite(ffile,string);
fclose(ffile);
return 1;
}