Need help with 2 things -
Danand - 07.02.2009
The first one is:
The /me commando, when we use it, it saying it 2 times for others, not me, but for others.
Code:
if(!strcmp(cmdtext, "/me", true, 3))
{
if(cmdtext[3] == 0) {
SendClientMessage(playerid, COLOR_YELLOW, "BRUK: /me tekst");
return 1;
}
new str[128], Float:Pos[3];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
for(new i = 0; i < MAX_PLAYERS; i++){
if(PlayerToPoint(40.0, i, Pos[0], Pos[1], Pos[2])){
SendClientMessageToAll(COLOR_YELLOW, str);
}
}
return 1;
}
The other is the /o(a chat for all), trying to make a command so i can take it on and off, but i cant it work.
Code:
new OOC;
if(!strcmp(cmdtext, "/ooc", true, 4))
{
if(GetPlayerScore(playerid) == 11)
{
OOC = cmdtext[4];
SendClientMessageToAll(COLOR_YELLOW, "!!OOC!!");
}
return 1;
}
if( !strcmp("/o", cmdtext, true, 2) )
{
new str[256], pname[256];
if(!OOC == true)
{
SendClientMessageToAll(COLOR_WHITE, "OOC kannalen er av!");
}
else
{
GetPlayerName(playerid, pname, 256);
format(str, 256, "OOC %s sier: (( %s ))", pname, cmdtext[3]);
SendClientMessageToAll(COLOR_WHITE, str);
}
return 1;
}
No errors at all..
Thank you for your time...
Re: Need help with 2 things -
Mikep - 07.02.2009
https://sampwiki.blast.hk/wiki/Using_strcmp%28%29
Theres an example.
Re: Need help with 2 things -
Danand - 07.02.2009
The /me command work, but it comming up 2 times when you say it so other hear it.
Re: Need help with 2 things -
Mikep - 07.02.2009
It says the /me text twice?
Re: Need help with 2 things -
Danand - 07.02.2009
Yes
Re: Need help with 2 things -
Nero_3D - 07.02.2009
just read the code what you have, you put SendClientMessage
ForAll in a loop
Re: Need help with 2 things -
Danand - 07.02.2009
I have tryd much now, i cant fix it.. I'm not soo good yet..
Re: Need help with 2 things -
Danand - 07.02.2009
Bumpi bump..
Re: Need help with 2 things -
ICECOLDKILLAK8 - 07.02.2009
1. Dont bump your thread
2. /m e command
pawn Code:
if(!strcmp(cmdtext, "/me", true, 3))
{
if(cmdtext[3] == 0) {
SendClientMessage(playerid, COLOR_YELLOW, "BRUK: /me tekst");
return 1;
}
new str[128], Float:Pos[3];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
for(new i = 0; i < MAX_PLAYERS; i++){
if(PlayerToPoint(40.0, i, Pos[0], Pos[1], Pos[2])){
SendClientMessage(COLOR_YELLOW, str);
}
}
return 1;
}
OOC command
pawn Code:
// top of script
new OOC;
// main command
if( !strcmp("/o", cmdtext, true, 2) )
{
new str[256], pname[256];
if(OOC == 0)
{
SendClientMessageToAll(COLOR_WHITE, "OOC kannalen er av!");
}
else
{
GetPlayerName(playerid, pname, 256);
format(str, 256, "OOC %s sier: (( %s ))", pname, cmdtext[3]);
SendClientMessageToAll(COLOR_WHITE, str);
}
return 1;
}
// toggle ooc
if( !strcmp("/togooc", cmdtext, true, 7) )
{
if(OOC == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "OOC turned on");
OOC = 1;
}
else if(OOC == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "OOC turned off");
OOC = 0;
}
return 1;
}
As all variables are 0 by default then OOC will be turned off automaticlly when your GM loads
Re: Need help with 2 things -
Jokerr_mayne - 01.05.2009
if(strcmp(cmd, "/me", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /me [action]");
return 1;
}
format(string, sizeof(string), "* %s %s", sendername, result);
ProxDetector(30.0, playerid, string, COLOR_ROZE,COLOR_ROZE,COLOR_ROZE,COLOR_ROZE,COLOR_ ROZE);
printf("%s", string);
return 1;
}