[Code request] /me command
#1

Hey I'm looking for the /me command, it has to be RP style so you can only see it if your close to the user thats using the '/me' command.

Who can help?
Reply
#2

pawn Код:
CMD:me(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SendClientMessage(playerid, -1, "USAGE: /me [action]");
        return 1;
    }
    else
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        format(string, sizeof(string), "* %s %s",pName, action);
    }
    return 1;
}
CMD:do(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SendClientMessage(playerid, -1, "USAGE: /do [action]");
        return 1;
    }
    else
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        format(string, sizeof(string), "* %s ((%s))",action, pName);
    }
    return 1;
}
here you go
Reply
#3

Try this one
pawn Код:
CMD:me(playerid,params[]) {
    new Message[128], sendername[MAX_PLAYER_NAME];
    new actiontext[MAX_CHATBUBBLE_LENGTH+1];
    new metext[MAX_CHATBUBBLE_LENGTH+1];
    if (sscanf(params, "s", Message)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /me <text>");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(actiontext,MAX_CHATBUBBLE_LENGTH,"* %s",Message);
    format(metext,MAX_CHATBUBBLE_LENGTH,"*%s %s",sendername,Message);
    SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,30.0,10000);
    SendClientMessageToAll(NICE_PINK,metext);
    return 1;
}
Reply
#4

Use ProxDetector to send the message to people near you.
Reply
#5

#includes:
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
Color:
pawn Код:
#define COLOR_PURPLE    0xC2A2DAAA
Stocks:
pawn Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
}

stock ProxDetector(Float:radi, playerid, string[],color)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    foreach(Player,i)
    {
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
        {
            SendClientMessage(i,color,string);
        }
    }
}
Command:
pawn Код:
CMD:me(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SendClientMessage(playerid, -1, "USAGE: /me [action]");
        return 1;
    }
    else
    {
        format(string, sizeof(string), "* %s %s.",(playerid), action);
        ProxDetector(30, playerid, string, COLOR_PURPLE);
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Cxnnor
Посмотреть сообщение
#includes:
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
Color:
pawn Код:
#define COLOR_PURPLE    0xC2A2DAAA
Stocks:
pawn Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
}

stock ProxDetector(Float:radi, playerid, string[],color)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    foreach(Player,i)
    {
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
        {
            SendClientMessage(i,color,string);
        }
    }
}
Command:
pawn Код:
CMD:me(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SendClientMessage(playerid, -1, "USAGE: /me [action]");
        return 1;
    }
    else
    {
        format(string, sizeof(string), "* %s %s.",(playerid), action);
        ProxDetector(30, playerid, string, COLOR_PURPLE);
    }
    return 1;
}
I got this error
Код:
fatal error 100: cannot read from file: "sscanf2"
Reply
#7

Download sscanf2.inc and put it inside Pawno --> Includes folder.
Reply
#8

Quote:
Originally Posted by Captain_Mani
Посмотреть сообщение
Download sscanf2.inc and put it inside Pawno --> Includes folder.
I have that right there but still get the same error.

Here is my whole script (It's new tough)
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
#include <sscanf2>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print("Test by STProjects");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print("Test by STProjects");
	print("----------------------------------\n");
}

#endif

//Colors

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x3A47DEFF
#define COLOR_TAN 0xBDB76BAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_BLACK 0x00000000
#define COLOR_DARKGREY 0x696969FF

public OnGameModeInit()
{
	//Misc
	SetGameModeText("Test Script");
	//Classes
	AddPlayerClass(0,1315.5812,-901.3412,39.5781,179.4360,0,0,0,0,0,0); // NewSpawn
	AddPlayerClass(0,1315.5812,-901.3412,39.5781,179.4360,0,0,0,0,0,0); // NewSpawn guy 2
	//Cars
	AddStaticVehicle(411,1493.5959,-882.4531,59.2338,296.6128,106,1); // Car1
	AddStaticVehicle(596,1584.9061,-1671.8037,5.6127,91.6886,0,1); // LSPD Car 1
    AddStaticVehicle(596,1584.5153,-1667.7305,5.6122,90.9567,0,1); // LSPD Car 2
    AddStaticVehicle(596,1595.7584,-1709.5861,5.6106,180.7830,0,1); // LSPD Car 3
    AddStaticVehicle(596,1587.5105,-1710.6382,5.6107,180.6751,0,1); // LSPD Car 4
    AddStaticVehicle(599,1574.3098,-1707.8007,6.0759,179.8558,0,1); // LSPD Car 5
    AddStaticVehicle(599,1564.2145,-1709.4862,6.0800,178.4991,0,1); // LSPD Car 6
    AddStaticVehicle(601,1543.7295,-1676.5759,5.6494,268.7270,1,1); // LSPD Car 8
    AddStaticVehicle(427,1538.8599,-1645.4301,6.0225,359.9162,0,1); // LSPD Car 9
    AddStaticVehicle(494,1530.8712,-1645.1381,5.7857,359.0612,54,36); // Car of officer
    AddStaticVehicle(409,1454.6981,-856.1747,53.4895,71.6437,1,1); // Limo 1
    AddStaticVehicle(409,1437.7620,-850.8962,51.0058,74.2248,1,1); // Limo 1
    AddStaticVehicle(409,1418.8579,-847.6682,47.9924,83.4644,1,1); // Limo 3
    AddStaticVehicle(417,1291.0210,-787.7387,96.5517,181.3363,0,0); // Heli on Maddog's mansion
    AddStaticVehicle(418,1308.8787,-871.8196,39.6712,86.9698,61,61); // Roboi's Food Mart Car 1
    AddStaticVehicle(418,1310.9316,-863.2705,39.6712,268.2620,119,119); // Roboi's Food Mart Car 2
    AddStaticVehicle(445,1311.7433,-857.1833,39.4531,88.0714,39,39); // Roboi's Food Mart Car 3
    AddStaticVehicleEx(405,2468.00000000,-1669.19995117,13.50000000,0.00000000,16,16,15); //Sentinel
    //Objects
    CreateObject(974,1545.00000000,-1635.80004883,15.30000019,0.00000000,0.00000000,268.00000000); //object(tall_fence) (1)
    CreateObject(974,1544.90002441,-1621.00000000,15.30000019,0.00000000,0.00000000,269.99499512); //object(tall_fence) (2)

	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid,1315.3195,-907.6172,38.1828);
	SetPlayerFacingAngle(playerid,359.6623);
	SetPlayerCameraPos(playerid,1315.0741,-911.5731,38.0785);
	SetPlayerCameraLookAt(playerid,1316.0923,-912.5001,37.9687);
	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[])
{

    if (strcmp("/helpme", cmdtext, true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "[INFO]This help command is still in BETA");
        SendClientMessage(playerid, COLOR_ORANGE, "[INFO]Enjoy the tutorial!");
        SendClientMessage(playerid, COLOR_ORANGE, "[INFO]/Heal - Heals you. /Kill - Performs suicide.");
        return 1;
    }
    if (strcmp("/healme", cmdtext, true, 5) == 0)
    {
        SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You have been healed!(This heal command is still in BETA!)");
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}
      
public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
////////////////////////////////////////////////////////////////////////////////
CMD:me(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SendClientMessage(playerid, -1, "USAGE: /me [action]");
        return 1;
    }
    else
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        format(string, sizeof(string), "* %s %s",pName, action);
    }
    return 1;
}
CMD:do(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SendClientMessage(playerid, -1, "USAGE: /do [action]");
        return 1;
    }
    else
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        format(string, sizeof(string), "* %s ((%s))",action, pName);
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by Songason
Посмотреть сообщение
I have that right there but still get the same error.

Here is my whole script (It's new tough)
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
#include <sscanf2>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print("Test by STProjects");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print("Test by STProjects");
	print("----------------------------------\n");
}

#endif

//Colors

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x3A47DEFF
#define COLOR_TAN 0xBDB76BAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_BLACK 0x00000000
#define COLOR_DARKGREY 0x696969FF

public OnGameModeInit()
{
	//Misc
	SetGameModeText("Test Script");
	//Classes
	AddPlayerClass(0,1315.5812,-901.3412,39.5781,179.4360,0,0,0,0,0,0); // NewSpawn
	AddPlayerClass(0,1315.5812,-901.3412,39.5781,179.4360,0,0,0,0,0,0); // NewSpawn guy 2
	//Cars
	AddStaticVehicle(411,1493.5959,-882.4531,59.2338,296.6128,106,1); // Car1
	AddStaticVehicle(596,1584.9061,-1671.8037,5.6127,91.6886,0,1); // LSPD Car 1
    AddStaticVehicle(596,1584.5153,-1667.7305,5.6122,90.9567,0,1); // LSPD Car 2
    AddStaticVehicle(596,1595.7584,-1709.5861,5.6106,180.7830,0,1); // LSPD Car 3
    AddStaticVehicle(596,1587.5105,-1710.6382,5.6107,180.6751,0,1); // LSPD Car 4
    AddStaticVehicle(599,1574.3098,-1707.8007,6.0759,179.8558,0,1); // LSPD Car 5
    AddStaticVehicle(599,1564.2145,-1709.4862,6.0800,178.4991,0,1); // LSPD Car 6
    AddStaticVehicle(601,1543.7295,-1676.5759,5.6494,268.7270,1,1); // LSPD Car 8
    AddStaticVehicle(427,1538.8599,-1645.4301,6.0225,359.9162,0,1); // LSPD Car 9
    AddStaticVehicle(494,1530.8712,-1645.1381,5.7857,359.0612,54,36); // Car of officer
    AddStaticVehicle(409,1454.6981,-856.1747,53.4895,71.6437,1,1); // Limo 1
    AddStaticVehicle(409,1437.7620,-850.8962,51.0058,74.2248,1,1); // Limo 1
    AddStaticVehicle(409,1418.8579,-847.6682,47.9924,83.4644,1,1); // Limo 3
    AddStaticVehicle(417,1291.0210,-787.7387,96.5517,181.3363,0,0); // Heli on Maddog's mansion
    AddStaticVehicle(418,1308.8787,-871.8196,39.6712,86.9698,61,61); // Roboi's Food Mart Car 1
    AddStaticVehicle(418,1310.9316,-863.2705,39.6712,268.2620,119,119); // Roboi's Food Mart Car 2
    AddStaticVehicle(445,1311.7433,-857.1833,39.4531,88.0714,39,39); // Roboi's Food Mart Car 3
    AddStaticVehicleEx(405,2468.00000000,-1669.19995117,13.50000000,0.00000000,16,16,15); //Sentinel
    //Objects
    CreateObject(974,1545.00000000,-1635.80004883,15.30000019,0.00000000,0.00000000,268.00000000); //object(tall_fence) (1)
    CreateObject(974,1544.90002441,-1621.00000000,15.30000019,0.00000000,0.00000000,269.99499512); //object(tall_fence) (2)

	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid,1315.3195,-907.6172,38.1828);
	SetPlayerFacingAngle(playerid,359.6623);
	SetPlayerCameraPos(playerid,1315.0741,-911.5731,38.0785);
	SetPlayerCameraLookAt(playerid,1316.0923,-912.5001,37.9687);
	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[])
{

    if (strcmp("/helpme", cmdtext, true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "[INFO]This help command is still in BETA");
        SendClientMessage(playerid, COLOR_ORANGE, "[INFO]Enjoy the tutorial!");
        SendClientMessage(playerid, COLOR_ORANGE, "[INFO]/Heal - Heals you. /Kill - Performs suicide.");
        return 1;
    }
    if (strcmp("/healme", cmdtext, true, 5) == 0)
    {
        SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You have been healed!(This heal command is still in BETA!)");
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}
      
public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
////////////////////////////////////////////////////////////////////////////////
CMD:me(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SendClientMessage(playerid, -1, "USAGE: /me [action]");
        return 1;
    }
    else
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        format(string, sizeof(string), "* %s %s",pName, action);
    }
    return 1;
}
CMD:do(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SendClientMessage(playerid, -1, "USAGE: /do [action]");
        return 1;
    }
    else
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        format(string, sizeof(string), "* %s ((%s))",action, pName);
    }
    return 1;
}
Are you sure you have the include in that folder? If so, check if you don't have multiple server installations. If you don't, check if you really put it in the PAWNO/Includes folder and not in the Includes folder in your server directory.
Reply
#10

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
Are you sure you have the include in that folder? If so, check if you don't have multiple server installations. If you don't, check if you really put it in the PAWNO/Includes folder and not in the Includes folder in your server directory.
Here this is my whole folder maybe you can find the problem?
http://www.mediafire.com/?71bsg2x029bf03d
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)