09.06.2009, 23:58
i cant get the witch /me question right to register
Originally Posted by rizla1986
i cant get the witch /me question right to register
|
} if(strcmp(cmd, "/me",true)==0) { new dir[256]; dir = strtok(cmdtext, idx); strmid(tmp, cmdtext, 4, strlen(cmdtext)); if(!strlen(dir)) { SendClientMessage(playerid,COLOR_GREY,"USAGE: /me [Action]"); return 1; } dir = strtok(cmdtext, idx); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s: %s", sendername, tmp); SendClientMessageToAll(COLOR_PURPLE,string); print(string); return 1; }
Originally Posted by Shady91
Is This what you ment.....
Код:
} if(strcmp(cmd, "/me",true)==0) { new dir[256]; dir = strtok(cmdtext, idx); strmid(tmp, cmdtext, 4, strlen(cmdtext)); if(!strlen(dir)) { SendClientMessage(playerid,COLOR_GREY,"USAGE: /me [Action]"); return 1; } dir = strtok(cmdtext, idx); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s: %s", sendername, tmp); SendClientMessageToAll(COLOR_PURPLE,string); print(string); return 1; } |
C:\DOCUME~1\Braeden\Desktop\SUPERS~1.0\SOURCE\GAMEMO~1\SU.pwn(15842) : error 017: undefined symbol "cmd" C:\DOCUME~1\Braeden\Desktop\SUPERS~1.0\SOURCE\GAMEMO~1\SU.pwn(15845) : error 017: undefined symbol "idx" C:\DOCUME~1\Braeden\Desktop\SUPERS~1.0\SOURCE\GAMEMO~1\SU.pwn(15846) : error 017: undefined symbol "tmp" C:\DOCUME~1\Braeden\Desktop\SUPERS~1.0\SOURCE\GAMEMO~1\SU.pwn(15852) : error 017: undefined symbol "idx" C:\DOCUME~1\Braeden\Desktop\SUPERS~1.0\SOURCE\GAMEMO~1\SU.pwn(15853) : error 017: undefined symbol "sendername" C:\DOCUME~1\Braeden\Desktop\SUPERS~1.0\SOURCE\GAMEMO~1\SU.pwn(15853) : error 017: undefined symbol "sendername" C:\DOCUME~1\Braeden\Desktop\SUPERS~1.0\SOURCE\GAMEMO~1\SU.pwn(15853) : error 029: invalid expression, assumed zero C:\DOCUME~1\Braeden\Desktop\SUPERS~1.0\SOURCE\GAMEMO~1\SU.pwn(15853) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 8 Errors.
Originally Posted by Shady91
new tmp2[256], tmp[256];
new sendername[MAX_PLAYER_NAME]; new cmd[256]; new moneys, idx; Add this to oncommandtext |
C:\DOCUME~1\Braeden\Desktop\SUPERS~1.0\SOURCE\GAMEMO~1\SU.pwn(13740) : warning 203: symbol is never used: "moneys" C:\DOCUME~1\Braeden\Desktop\SUPERS~1.0\SOURCE\GAMEMO~1\SU.pwn(13737) : warning 204: symbol is assigned a value that is never used: "tmp2
new tmp[256]; new sendername[MAX_PLAYER_NAME]; new cmd[256]; new idx; if(strcmp(cmd, "/me",true)==0) { new dir[256]; dir = strtok(cmdtext, idx); strmid(tmp, cmdtext, 4, strlen(cmdtext)); if(!strlen(dir)) { SendClientMessage(playerid,COLOR_GREY,"USAGE: /me [Action]"); return 1; } dir = strtok(cmdtext, idx); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s %s", sendername, tmp); SendClientMessageToAll(COLOR_GREY,string); print(string); return 1; }
//top of script
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
//the color
#define COLOR_PURPLE 0x800080AA
//onplayercommandtext
new cmd[256];
if(strcmp(cmd, "/me", true) == 0)
{
if(IsPlayerConnected(playerid))
{
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_YELLOW, "USAGE: /me [action]");
return 1;
}
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;
}
//bottom of the script
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))
{
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;
}