Well, im a noob at converting commands so i need help
#1

Код:
    if(IsPlayerAdmin(playerid))
    {
		if(!strcmp("/gotomb", cmdtext, true))
		{
		    SetPlayerPos(playerid, MoneyBagPos[0], MoneyBagPos[1] +3, MoneyBagPos[2]);
		    return SendClientMessage(playerid, -1, ""red">> "grey" You have been teleported to the "orange"Money Bag");
		}
		if(!strcmp("/startmb", cmdtext, true)) return MoneyBag();
		if(!strcmp("/togglemb", cmdtext, true))
		{
			if(Timer[0] == 0)
			{
				KillTimer(Timer[1]);
				Timer[0] = 1;
				SendClientMessage(playerid, -1, ""green">> "orange"Money Bag "grey" is "green"Enabled");
				return 1;
			}
			if(Timer[0] == 1)
			{
			    Timer[1] = SetTimer("MoneyBag", MB_DELAY, true);
			    Timer[0] = 0;
			    SendClientMessage(playerid, -1, ""red">> "orange"Money Bag "grey" is "red"Disabled");
			    return 1;
			}
		    return 1;
		}

	}
	if(!strcmp("/moneybag", cmdtext, true))
	{
	    new string[150];
		if(!MoneyBagFound) format(string, sizeof(string), ""white"["red"MONEYBAG"white"] "grey"The "orange"Money Bag "grey"has been hidden in "orange"%s!", MoneyBagLocation);
		if(MoneyBagFound) format(string, sizeof(string), ""white"["red"MONEYBAG"white"] "orange"Money Bag "grey"is not running!");
		return SendClientMessage(playerid, -1, string);
	}
well if someone can help me convert these commands into ZCMD it would be great


and im getting problems with this code even thou i don't know wtf is happening

Код:
CMD:pm(playerid, params[])
{
    new string[2][128], message[128];
    if(sscanf(params,"us[128]",id,message)) return SendClientMessage(playerid, -1, ""red"Usage: /pm <id> <message>");
    if(id == playerid) return SendClientMessage(playerid, -1, ""red"[ERROR] You cannot send a pm to yourself");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, ""red"[ERROR] Player is not connected");
    format(string[0], 128, ""yellow">>> Pm Sent to %s: %s", PlayerName(id), message);
    format(string[1], 128, ""yellow"<<< Pm From %s: %s", PlayerName(playerid), message);
    SendClientMessage(playerid, -1, string[0]);
    SendClientMessage(id, -1, string[1]);
    LastPm[id] = playerid;
    return 1;
}
the warnings

Код:
C:\Documents and Settings\All Users\Desktop\New Royal Gaming\gamemodes\ngcgm.pwn(3779) : warning 213: tag mismatch
C:\Documents and Settings\All Users\Desktop\New Royal Gaming\gamemodes\ngcgm.pwn(3780) : warning 213: tag mismatch
C:\Documents and Settings\All Users\Desktop\New Royal Gaming\gamemodes\ngcgm.pwn(3780) : warning 205: redundant code: constant expression is zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Reply
#2

Use color embedding
PHP код:
CMD:pm(playeridparams[])
{
    new 
string[2][128], message[128];
    if(
sscanf(params,"us[128]",id,message)) return SendClientMessage(playerid, -1""red"Usage: /pm <id> <message>");
    if(
id == playerid) return SendClientMessage(playerid, -1"{FF0000}[ERROR] You cannot send a pm to yourself");
    if(
id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"{FF0000}[ERROR] Player is not connected");
    
format(string[0], 128"{FFF700}>>> Pm Sent to %s: %s"PlayerName(id), message);
    
format(string[1], 128"{FFF700}<<< Pm From %s: %s"PlayerName(playerid), message);
    
SendClientMessage(playerid, -1string[0]);
    
SendClientMessage(id, -1string[1]);
    
LastPm[id] = playerid;
    return 
1;

Reply
#3

thanks and can you help me convert those cmds into ZCMD? thanks
Reply
#4

its simple to convert to zcmd i will convert first cmd for you so that you can convert others too (try first if you cant tell it here thats how we learn)
PHP код:
if(!strcmp("/gotomb"cmdtexttrue))
        {
            
SetPlayerPos(playeridMoneyBagPos[0], MoneyBagPos[1] +3MoneyBagPos[2]);
            return 
SendClientMessage(playerid, -1""red">> "grey" You have been teleported to the "orange"Money Bag");
        } 
coverted to
PHP код:
CMD:gotomb(playerid,params[])
{
 
SetPlayerPos(playeridMoneyBagPos[0], MoneyBagPos[1] +3MoneyBagPos[2]);
  
SendClientMessage(playerid, -1""red">> "grey" You have been teleported to the "orange"Money Bag");
  return 
1;

Reply
#5

And in the other commands also use color embedding
PHP код:
CMD:gotomb(playerid,params[]) 

    
SetPlayerPos(playeridMoneyBagPos[0], MoneyBagPos[1] +3MoneyBagPos[2]); 
    
SendClientMessage(playerid, -1"{FF0000}>> {BABABA} You have been teleported to the {FFA600}Money Bag"); 
    return 
1

Reply
#6

so it should be like this right?


PHP код:
CMD:gotomb(playerid,params[])
{
    
SetPlayerPos(playeridMoneyBagPos[0], MoneyBagPos[1] +3MoneyBagPos[2]);
    
SendClientMessage(playerid, -1""red">> "grey" You have been teleported to the "orange"Money Bag");
    return 
1;
}
CMD:moneybag(playerid,params[])
{
    new 
string[150];
    if(!
MoneyBagFoundformat(stringsizeof(string), ""white"["red"MONEYBAG"white"] "grey"The "orange"Money Bag "grey"has been hidden in "orange"%s!"MoneyBagLocation);
    if(
MoneyBagFoundformat(stringsizeof(string), ""white"["red"MONEYBAG"white"] "orange"Money Bag "grey"is not running!"); return SendClientMessage(playerid, -1string);
    return 
1;
}
CMD:startmb(playeridparams[])
{
  return 
cmd_togglemb(playeridparams);
}
CMD:togglemb(playerid,params[])
{
    if(
Timer[0] == 0)
    {
        
KillTimer(Timer[1]);
        
Timer[0] = 1;
        
SendClientMessage(playerid, -1""green">> "orange"Money Bag "grey" is "green"Enabled");
        return 
1;
        }
        if(
Timer[0] == 1)
        {
        
Timer[1] = SetTimer("MoneyBag"MB_DELAYtrue);
        
Timer[0] = 0;
        
SendClientMessage(playerid, -1""red">> "orange"Money Bag "grey" is "red"Disabled");
    }
    return 
1;

Reply
#7

And don't forget, the commands must not be inside any callback
Reply
#8

getting these warnings from the code

Quote:

C:\Documents and Settings\All Users\Desktop\New Gaming Class [BUILD 2]\gamemodes\ngcgm.pwn(3471) : warning 225: unreachable code
C:\Documents and Settings\All Users\Desktop\New Gaming Class [BUILD 2]\gamemodes\ngcgm.pwn(3489) : warning 217: loose indentation
C:\Documents and Settings\All Users\Desktop\New Gaming Class [BUILD 2]\gamemodes\ngcgm.pwn(3495) : warning 217: loose indentation
C:\Documents and Settings\All Users\Desktop\New Gaming Class [BUILD 2]\gamemodes\ngcgm.pwn(3782) : warning 213: tag mismatch
C:\Documents and Settings\All Users\Desktop\New Gaming Class [BUILD 2]\gamemodes\ngcgm.pwn(3783) : warning 213: tag mismatch
C:\Documents and Settings\All Users\Desktop\New Gaming Class [BUILD 2]\gamemodes\ngcgm.pwn(3783) : warning 205: redundant code: constant expression is zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Warnings.

the 3778 -> 3804 was from

PHP код:
CMD:pm(playeridparams[])
{
    new 
stringes[2][128], message[128];
    if(
sscanf(params,"us[128]",id,message)) return SendClientMessage(playerid, -1""red"Usage: /pm <id> <message>");
    if(
id == playerid) return SendClientMessage(playerid, -1"{FF0000}[ERROR] You cannot send a pm to yourself");
    if(
id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"{FF0000}[ERROR] Player is not connected");
    
format(stringes[0], 128"{FFF700}>>> Pm Sent to %s: %s"PlayerName(id), message);
    
format(stringes[1], 128"{FFF700}<<< Pm From %s: %s"PlayerName(playerid), message);
    
SendClientMessage(playerid, -1stringes[0]);
    
SendClientMessage(id, -1stringes[1]);
    
LastPm[id] = playerid;
    return 
1;
}
CMD:r(playeridparams[])
{
    new 
stringad[2][128], message[128];
    if(
LastPm[playerid] == -1) return SendClientMessage(playerid, -1""red"[ERROR] No one has pm'ed you since you joined the server");
    if(
LastPm[playerid] == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1""red"[ERROR] The player that last pm'ed you is not online");
    if(
sscanf(params,"s[128]",message)) return SendClientMessage(playerid, -1""red"Usage: /r <message>");
    
format(stringad[0], 128""yellow">>> PM Sent to %s: %s"PlayerName(LastPm[playerid]), message);
    
format(stringad[1], 128""yellow"<<< PM From %s: %s"PlayerName(playerid), message);
    
SendClientMessage(playerid, -1stringad[0]);
    
SendClientMessage(LastPm[playerid], -1stringad[1]);
    
LastPm[LastPm[playerid]] = playerid;
    return 
1;

from
PHP код:
 if(id == playerid) return SendClientMessage(playerid, -1"{FF0000}[ERROR] You cannot send a pm to yourself");
    if(
id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"{FF0000}[ERROR] Player is not connected"); 
Reply
#9

You can fix indent warning by pretty printing the code eg:

PHP код:
if(sometihing==67)
{
 print(
"Blahh");
   print(
"blahh");
print(
"blahh");

above code is not indented thats is not neatly written
indent it like
PHP код:
if(sometihing==67)
{
 print(
"Blahh");
 print(
"blahh");
 print(
"blahh");

you should show us how you defined those colors
and you are pointing wrong lines that having warnings
Reply
#10

Color embedding again..
https://sampwiki.blast.hk/wiki/Colour_Embedding
PHP код:
CMD:gotomb(playerid,params[]) 

    
SetPlayerPos(playeridMoneyBagPos[0], MoneyBagPos[1] +3MoneyBagPos[2]); 
    
SendClientMessage(playerid, -1"{FF0000}>> {BABABA} You have been teleported to the {FF8800}Money Bag"); 
    return 
1

CMD:moneybag(playerid,params[]) 

    new 
string[150]; 
    if(
MoneyBagFoundformat(stringsizeof(string), "{FFFFFF}[{FF0000}MONEYBAG{FFFFFF}] {FF8800}Money Bag {BABABA}is not running!"); return SendClientMessage(playerid, -1string); 
    if(!
MoneyBagFoundformat(stringsizeof(string), "{FFFFFF}[{FF0000}MONEYBAG{FFFFFF}] {BABABA}The {FF8800}Money Bag {BABABA}has been hidden in {FF8800}%s!"MoneyBagLocation); 
    return 
1

CMD:startmb(playeridparams[]) 

    
cmd_togglemb(playeridparams); 
    return 
1;

CMD:togglemb(playerid,params[]) 

    if(
Timer[0] == 0
    { 
        
KillTimer(Timer[1]); 
        
Timer[0] = 1
        
SendClientMessage(playerid, -1"{00FF00}>> {FF8800}Money Bag {BABABA} is {00FF00}Enabled"); 
    } 
    else if(
Timer[0] == 1
    { 
        
Timer[1] = SetTimer("MoneyBag"MB_DELAYtrue); 
        
Timer[0] = 0
        
SendClientMessage(playerid, -1"{FF0000}>> {FF8800}Money Bag {BABABA} is {FF0000}Disabled"); 
    } 
    return 
1

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)