Big GooD HELP ThANx
#1

ehm, i wanna get the /god and /me to work. but it doesnt :S here is the full script:

Code:
/* SA:MP /god and /me commands
 * Made by My_Waffles_Bitch
*/
//==============================================================================

#include <a_samp>

#define CMDS true

#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

//==============================================================================

dcmd_me(playerid, params&#91;] ) {
	new
		msg[128];
	if (sscanf(params, "s",msg)) {
		format(s,sizeof(s),"%s:[USAGE]: /me <MESSAGE>",icommands);
		return SendClientMessage(playerid,COLOR_SYSTEM,s);
	}
	if(PlayerInfo[playerid][mute]) {
		return 0;
  }
	else {
		format(s,sizeof(s),"%s %s",PlayerName(playerid),msg);
		SendClientMessageToAll(COLOR_WHITE,s);
		WriteLog(clearlog,s);
	}
	return true;
}

dcmd_god(playerid, params&#91;] ) {
  if(God[playerid] == 0)
  {
  God[playerid] = 1;
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  SendClientMessageToAll(0xAAAAAAAA,"%s has turned Godmode on.",pName);
  }
  else
  {
  God[playerid] = 0;
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  SendClientMessageToAll(0xAAAAAAAA,"%s has turned godmode off.",pName);
  SetPlayerHealth(playerid, 100);
  }
  return true;
}
and i get this:

Code:
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(32) : warning 203: symbol is never used: "dcmd_god"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(32 -- 52) : warning 203: symbol is never used: "dcmd_me"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
but the warnings ain't the point to why im askin for help, im askin for help cuz it doesnt work :S so plz help, and give me the full script in a code thanx :mgreen:
Reply
#2

you forgot the important part on onplayercommandtext
pawn Code:
dcmd(me, 2, cmdtext);
dcmd(god, 3, cmdtext);
Reply
#3

Quote:
Originally Posted by ♣ ⓐⓢⓢ
you forgot the important part on onplayercommandtext
pawn Code:
dcmd(me, 2, cmdtext);
dcmd(god, 3, cmdtext);
where should i put it?
Reply
#4

Ontop of OnPlayerCommand..
Reply
#5

now i got this:

Code:
/* SA:MP /god and /me commands
 * Made by My_Waffles_Bitch
*/
//==============================================================================

#include <a_samp>

#define CMDS true

#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

//==============================================================================

public OnPlayerCommandText(playerid, cmdtext&#91;])
{
dcmd(me, 2, cmdtext);
dcmd(god, 3, cmdtext);

dcmd_me(playerid, params&#91;] ) {
	new
		msg[128];
	if (sscanf(params, "s",msg)) {
		format(s,sizeof(s),"%s:[USAGE]: /me <MESSAGE>",icommands);
		return SendClientMessage(playerid,COLOR_SYSTEM,s);
	}
	if(PlayerInfo[playerid][mute]) {
		return 0;
  }
	else {
		format(s,sizeof(s),"%s %s",PlayerName(playerid),msg);
		SendClientMessageToAll(COLOR_WHITE,s);
		WriteLog(clearlog,s);
	}
	return true;
}

dcmd_god(playerid, params&#91;] ) {
  if(God[playerid] == 0)
  {
  God[playerid] = 1;
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  SendClientMessageToAll(0xAAAAAAAA,"%s has turned Godmode on.",pName);
  }
  else
  {
  God[playerid] = 0;
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  SendClientMessageToAll(0xAAAAAAAA,"%s has turned godmode off.",pName);
  SetPlayerHealth(playerid, 100);
  }
  return true;
}
and get these errors:

Code:
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(16) : error 017: undefined symbol "dcmd_me"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(17) : error 017: undefined symbol "dcmd_god"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(19) : error 017: undefined symbol "dcmd_me"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(22) : error 017: undefined symbol "sscanf"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(23) : error 017: undefined symbol "s"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(23) : error 017: undefined symbol "s"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(23) : error 029: invalid expression, assumed zero
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(23) : fatal error 107: too many error messages on one line

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


8 Errors.
Reply
#6

Hm.. ignore what i said
Reply
#7

Quote:
Originally Posted by My_Waffles_Bitch_L0L
now i got this:

Code:
/* SA:MP /god and /me commands
 * Made by My_Waffles_Bitch
*/
//==============================================================================

#include <a_samp>

#define CMDS true

#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

//==============================================================================

public OnPlayerCommandText(playerid, cmdtext&#91;])
{
dcmd(me, 2, cmdtext);
dcmd(god, 3, cmdtext);

dcmd_me(playerid, params&#91;] ) {
	new
		msg[128];
	if (sscanf(params, "s",msg)) {
		format(s,sizeof(s),"%s:[USAGE]: /me <MESSAGE>",icommands);
		return SendClientMessage(playerid,COLOR_SYSTEM,s);
	}
	if(PlayerInfo[playerid][mute]) {
		return 0;
  }
	else {
		format(s,sizeof(s),"%s %s",PlayerName(playerid),msg);
		SendClientMessageToAll(COLOR_WHITE,s);
		WriteLog(clearlog,s);
	}
	return true;
}

dcmd_god(playerid, params&#91;] ) {
  if(God[playerid] == 0)
  {
  God[playerid] = 1;
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  SendClientMessageToAll(0xAAAAAAAA,"%s has turned Godmode on.",pName);
  }
  else
  {
  God[playerid] = 0;
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  SendClientMessageToAll(0xAAAAAAAA,"%s has turned godmode off.",pName);
  SetPlayerHealth(playerid, 100);
  }
  return true;
}
and get these errors:

Code:
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(16) : error 017: undefined symbol "dcmd_me"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(17) : error 017: undefined symbol "dcmd_god"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(19) : error 017: undefined symbol "dcmd_me"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(22) : error 017: undefined symbol "sscanf"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(23) : error 017: undefined symbol "s"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(23) : error 017: undefined symbol "s"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(23) : error 029: invalid expression, assumed zero
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(23) : fatal error 107: too many error messages on one line

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


8 Errors.
I think the above poster meant on top of public OnPlayerCommandText(playerid, cmdtext&#91;])
Reply
#8

now i got this:
Code:
/* SA:MP /god and /me commands
 * Made by My_Waffles_Bitch
*/
//==============================================================================

#include <a_samp>

#define CMDS true

#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

//==============================================================================

dcmd(me, 2, cmdtext);
dcmd(god, 3, cmdtext);

public OnPlayerCommandText(playerid, cmdtext&#91;])

dcmd_me(playerid, params&#91;] ) {
	new
		msg[128];
	if (sscanf(params, "s",msg)) {
		format(s,sizeof(s),"%s:[USAGE]: /me <MESSAGE>",icommands);
		return SendClientMessage(playerid,COLOR_SYSTEM,s);
	}
	if(PlayerInfo[playerid][mute]) {
		return 0;
  }
	else {
		format(s,sizeof(s),"%s %s",PlayerName(playerid),msg);
		SendClientMessageToAll(COLOR_WHITE,s);
		WriteLog(clearlog,s);
	}
	return true;
}

dcmd_god(playerid, params&#91;] ) {
  if(God[playerid] == 0)
  {
  God[playerid] = 1;
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  SendClientMessageToAll(0xAAAAAAAA,"%s has turned Godmode on.",pName);
  }
  else
  {
  God[playerid] = 0;
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  SendClientMessageToAll(0xAAAAAAAA,"%s has turned godmode off.",pName);
  SetPlayerHealth(playerid, 100);
  }
  return true;
}
and got these new errors:

Code:
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(14) : error 010: invalid function or declaration
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(15) : error 010: invalid function or declaration
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(19) : error 017: undefined symbol "dcmd_me"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(22) : error 010: invalid function or declaration
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(24) : error 010: invalid function or declaration
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(26) : error 010: invalid function or declaration
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(27) : error 010: invalid function or declaration
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(29) : error 010: invalid function or declaration
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(33) : error 054: unmatched closing brace ("}")
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(34) : error 010: invalid function or declaration
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(37) : warning 203: symbol is never used: "dcmd_god"
C:\Users\Martin\Desktop\PUTDETHERINTILSA-MP\god-me.pwn(37 -- 57) : warning 203: symbol is never used: "msg"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


10 Errors.
so, can someone give me a code with the full script?
Reply
#9

come on, i REALLY need this!! plz give me more help, or the script in a code will be good too!!!
Reply
#10

pawn Code:
/* SA:MP /god and /me commands
 * Made by My_Waffles_Bitch
*/

//==============================================================================

#include <a_samp>

#define CMDS true

#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

//==============================================================================

public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(me, 2, cmdtext);
dcmd(god, 3, cmdtext);
}
dcmd_me(playerid, params[] ) {
    new
        msg[128];
    if (sscanf(params, "s",msg)) {
        format(s,sizeof(s),"%s:[USAGE]: /me <MESSAGE>",icommands);
        return SendClientMessage(playerid,COLOR_SYSTEM,s);
    }
    if(PlayerInfo[playerid][mute]) {
        return 0;
  }
    else {
        format(s,sizeof(s),"%s %s",PlayerName(playerid),msg);
        SendClientMessageToAll(COLOR_WHITE,s);
        WriteLog(clearlog,s);
    }
    return true;
}

dcmd_god(playerid, params[] ) {
  if(God[playerid] == 0)
  {
  God[playerid] = 1;
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  SendClientMessageToAll(0xAAAAAAAA,"%s has turned Godmode on.",pName);
  }
  else
  {
  God[playerid] = 0;
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  SendClientMessageToAll(0xAAAAAAAA,"%s has turned godmode off.",pName);
  SetPlayerHealth(playerid, 100);
  }
  return true;
}
//=======================================================================
stock sscanf(string[], format[], {Float,_}:...) {
    new formatPos = 0, stringPos = 0, paramPos = 2, paramCount = numargs();
    while (paramPos < paramCount && string[stringPos]){
        switch (format[formatPos++]){
            case '\0':{
                return 0;
            }case 'i', 'd':{
                new
                    neg = 1,
                    num = 0,
                    ch = string[stringPos];
                if (ch == '-'){
                    neg = -1;
                    ch = string[++stringPos];
                }do{
                    stringPos++;
                    if (ch >= '0' && ch <= '9'){
                        num = (num * 10) + (ch - '0');
                    }else{
                        return 1;
                    }
                }while ((ch = string[stringPos]) && ch != ' ');
                setarg(paramPos, 0, num * neg);
            }case 'h', 'x':{
                new ch, num = 0;
                while ((ch = string[stringPos++])){
                    switch (ch){
                        case 'x', 'X':{
                            num = 0;
                            continue;
                        }case '0' .. '9':{
                            num = (num << 4) | (ch - '0');
                        }case 'a' .. 'f':{
                            num = (num << 4) | (ch - ('a' - 10));
                        }case 'A' .. 'F':{
                            num = (num << 4) | (ch - ('A' - 10));
                        }case ' ':{
                            break;
                        }default:{
                            return 1;
                        }
                    }
                }setarg(paramPos, 0, num);
            }case 'c':{
                setarg(paramPos, 0, string[stringPos++]);
            }case 'f':{
                new tmp[25];
                strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2);
                setarg(paramPos, 0, _:floatstr(tmp));
            }case 's', 'z':{
                new i = 0, ch;
                if (format[formatPos]){
                    while ((ch = string[stringPos++]) && ch != ' '){
                        setarg(paramPos, i++, ch);
                    }if (!i) return 1;
                }else{
                    while ((ch = string[stringPos++])){
                        setarg(paramPos, i++, ch);
                    }
                }stringPos--;
                setarg(paramPos, i, '\0');
            }default:{
                continue;
            }
        }while (string[stringPos] && string[stringPos] != ' '){
            stringPos++;
        }while (string[stringPos] == ' '){
            stringPos++;
        }paramPos++;
    }while (format[formatPos] == 'z') formatPos++;
    return format[formatPos];
}
Try that..You didnt put sscanf code, but you used it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)