Command being weird - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command being weird (
/showthread.php?tid=171806)
Command being weird -
[SCRP]Cody - 28.08.2010
Ok, I'm having some problems with two of my commands. They are both causing problems which don't seem to make sense to me.
To start, whenever I type a command with /re in it, it automatically brings up the gas menu which is /refuel, can anyone help with this problem? My refuel command is set up like this-
Код:
if (strcmp("/refuel", cmdtext, true, 3) == 0) {
if(IsPlayerInCircle(playerid,-2261.0549316406,2360.0112304688,8) || IsPlayerInCircle(playerid,-2511.4931640625,2396.8508300781,12) || IsPlayerInCircle(playerid,-2511.4931640625,2396.8508300781,12) || IsPlayerInCircle(playerid,-1610.3709716797,732.82781982422,8)|| IsPlayerInCircle(playerid,-1675.6549072266,412.8293762207,14)|| IsPlayerInCircle(playerid,-2411.5715332031,976.22265625,14) || IsPlayerInCircle(playerid,-2282.8156738281,548.01324462891,12) ||
IsPlayerInCircle(playerid,-2036.7264404297,61.878116607666,12) || IsPlayerInCircle(playerid,-2466.5341796875,-135.15104675293,9) || IsPlayerInCircle(playerid,-1132.9149169922,-1214.1840820313,10) ) {
ShowMenuForPlayer(MenuGas,playerid);
TogglePlayerControllable(playerid,0);
}else{
SendClientMessage(playerid, COLOR_RED, "Head to the nearest gas station to refuel your car.")
}
return 1;
}
Also, I'm having problems with my /me command, instead of just being like /meg (Besides the distance), you have to put three spaces after /me to make it work correctly, my /me is set up like this-
Код:
if(strcmp(cmd, "/me", true) == 0)
{
for(new i=0; i<MAX_PLAYERS; i++){
new dir[256];
new tmp[256];
dir = strtok(cmdtext, idx);
strmid(tmp, cmdtext, 6, strlen(cmdtext));
if(GetDistanceBetweenPlayers(playerid,i) < 50) {
dir = strtok(cmdtext, idx);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s: %s", sendername, tmp);
SendClientMessage(i,0x63872CFF,string);
printf(string);
format(string, sizeof(string), "%s %s", sendername, tmp);
print(string);
}
}
return 1;
}
If you can help me fix these it would be greatly appreciated.
Re: Command being weird -
Adil - 28.08.2010
change
if (strcmp("/refuel", cmdtext, true, 3) == 0) { to
if (strcmp("/refuel", cmdtext, true, 7) == 0) {. And for the second one, why not just use ProxDetector?