Need Help Scripting A /do Command
#1

Hi, I need help scripting a /do command. I've tried to in the past but I keep getting errors and the compiler bugs out and crashes. I have the /me script done but I just need the /do.
Any Help will be appreciated.

Thanks in advance.
Reply
#2

Try to use this :

Код:
	if(strcmp(cmd, "/do", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(gPlayerLogged[playerid] == 0)
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet !");
	      return 1;
	    }
	    if(PlayerInfo[playerid][pMuted] == 1)
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
				return 1;
			}
		
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[128];
			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: /do [action]");
				return 1;
			}
			if(PlayerInfo[playerid][pAdminDuty] == 1)
			{
  				format(string, sizeof(string), "%s (( Admin ))", result);
			}
			if(PlayerInfo[playerid][pMaskuse] == 1 && PlayerInfo[playerid][pAdminDuty] == 0)
			{
			  format(string, sizeof(string), "* %s (( Stranger ))", result);
			}
			if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 0)
			{
				format(string, sizeof(string), "* %s (( %s ))", result, sendername);
			}
			ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
			new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] [/DO] %s: %s",d,m,y,h,mi,s,sendername,giveplayer, result);
			ActionLog(string);
		}
		return 1;
The command is not made by me, i just took it out of a script
Reply
#3

I get these errors:
C:\Users\Nathan\Desktop\Server\pawno\RPScript.pwn( 36) : warning 217: loose indentation
C:\Users\Nathan\Desktop\Server\pawno\RPScript.pwn( 147) : warning 202: number of arguments does not match definition
C:\Users\Nathan\Desktop\Server\pawno\RPScript.pwn( 247) : warning 217: loose indentation
C:\Users\Nathan\Desktop\Server\pawno\RPScript.pwn( 247) : error 017: undefined symbol "cmd"
C:\Users\Nathan\Desktop\Server\pawno\RPScript.pwn( 251) : error 017: undefined symbol "gPlayerLogged"
C:\Users\Nathan\Desktop\Server\pawno\RPScript.pwn( 251) : warning 215: expression has no effect
C:\Users\Nathan\Desktop\Server\pawno\RPScript.pwn( 251) : error 001: expected token: ";", but found "]"
C:\Users\Nathan\Desktop\Server\pawno\RPScript.pwn( 251) : error 029: invalid expression, assumed zero
C:\Users\Nathan\Desktop\Server\pawno\RPScript.pwn( 251) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

Thanks in advance.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)