2 questions -
Mystique - 23.12.2009
Okay I have 2 questions.
I'm making a rp server so ill need a ranged /me command but i dont know how to make it ranged.. I need someone to show me a complete ranged /me command and tell me where to put all parts.
Second:
I want to make that all entrances (teles) will work with /enter but i only get one of them to work... Here's my script of one 24/7 tele.. Could someone write how i could make the /enter command aviable for 2 or more teles?
Код:
if(strcmp(cmdtext, "/enter",true) ==0)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, 994.287902,-1296.121948,13.546875))
{
SetPlayerPos(playerid, -30.946699, -89.609596, 1003.549988);
SetPlayerInterior(playerid, 18);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not near a 24/7.");
}
return 1;
}
Re: 2 questions -
[NYRP]Mike. - 23.12.2009
The /me command:
pawn Код:
//----------------------------------[Emote]-----------------------------------------------
if(strcmp(cmd, "/me", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new sendername[MAX_PLAYER_NAME];
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;
}
if(!IsPlayerConnected(playerid))
{
format(string, sizeof(string), "You cannot use this command Yet!", result);
}
else
{
format(string, sizeof(string), "* %s %s", sendername, result);
}
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
printf("%s", string);
}
return 1;
}
the ProxDetector // used to send messages in a certain radius
pawn Код:
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5); // on top of script
pawn Код:
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
//radi = 2.0; //Trigger Radius
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
if(!BigEar[i])
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, string);
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
}//not connected
return 1;
}
Re: 2 questions -
Mystique - 23.12.2009
thanks you very much
ill try it
Re: 2 questions -
Joe Staff - 23.12.2009
That's such a horrible way to do it. There's waayy too much excess code there.
pawn Код:
if(!strcmp(cmdtext[1],"me",true,2))
{
new Float:x,Float:y,Float:z,tmpstring[160];
GetPlayerName(playerid,tmpstring,sizeof(tmpstring));
format(tmpstring,sizeof(tmpstring)," *%s %s*",tmpstring,cmdtext[4]);
for(new player;player<MAX_PLAYERS;player++)
{
if(IsPlayerInRangeOfPoint(player,10.0,x,y,z))SendClientMessage(player,0xAA77AAFF,tmpstring);
}
return 1;
}
Re: 2 questions -
Mystique - 23.12.2009
Код:
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(299) : warning 217: loose indentation
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(299) : error 017: undefined symbol "cmd"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(304) : warning 217: loose indentation
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(306) : error 017: undefined symbol "idx"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(308) : error 017: undefined symbol "idx"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(308) : warning 215: expression has no effect
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(310) : error 017: undefined symbol "idx"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(312) : error 017: undefined symbol "idx"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(314) : error 017: undefined symbol "idx"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(315) : error 017: undefined symbol "idx"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(315) : warning 215: expression has no effect
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(317) : error 017: undefined symbol "idx"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(320) : error 017: undefined symbol "COLOR_GRAD2"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(325) : error 017: undefined symbol "string"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(325) : error 017: undefined symbol "string"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(325) : error 029: invalid expression, assumed zero
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(325) : fatal error 107: too many error messages on one line
Re: 2 questions -
Mystique - 23.12.2009
ill try to do it your way joe
Re: 2 questions -
Niixie - 23.12.2009
Heres my me command. I used ALOT of time on it to get it working
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(me, 2, cmdtext);
return 0;
}
dcmd_me(playerid, params[])
{
new
output[ 128 ] ,
pName[ MAX_PLAYER_NAME ] ,
string[ 157 ];
if (sscanf(params, "s", output)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"* Niixie <action>\"");
else
{
GetPlayerName( playerid , pName , sizeof( pName ) );
format(string, sizeof(string), "* %s: %s", pName, output);
ProxDetector(30.0, playerid, string, Purple,Purple,Purple,Purple,Purple);
}
return 1;
}
Re: 2 questions -
Mystique - 23.12.2009
Joe, when i type /me or /me laughs it doesnt show anything... it doesnt say server unknown command.. i mean its like you never typed it
Re: 2 questions -
Mystique - 23.12.2009
niixie, I got this error
Код:
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(222) : error 017: undefined symbol "dcmd"
C:\Users\Broman\Desktop\gta\samp03asvr_win32\gamemodes\Roleplay.pwn(479) : warning 203: symbol is never used: "dcmd_me"
Re: 2 questions -
Niixie - 23.12.2009
Use this define in the top of your script
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1