help with command
#1

this command is not working idk why,help please..

Код:
   else if(!strcmp(Mine, "TMine", true))
	{
		new string[256],sec;
	    if(sscanf(params, "i", sec))
		return SendClientMessage(playerid, COLOR_RED, "USAGE: /placemine [Tmine] [Seconds]");
		TimeBombPlaced[playerid] = 1;
		GetPlayerPos(playerid,MineX,MineY,MineZ);
		TimeBombObject = CreateObject(1252,MineX,MineY,MineZ-1,0.0, 0.0, 96.0);
		MinePos[playerid][0] = MineX;
		MinePos[playerid][1] = MineY;
		MinePos[playerid][2] = MineZ;
		TimeBombLabel = Create3DTextLabel("MINE HERE",COLOR_INDIANRED, MineX, MineY, MineZ, 20.0, 0, 0);
		format(string,sizeof(string),"You have set a time bomb of %i seconds.",sec);
		SendClientMessage(playerid,COLOR_PURPLE,string);
		TimeBombUpdate[playerid] = SetTimerEx("TimeBomb", sec*1000, false, "i", playerid);
	}
Reply
#2

That's not the syntax of a command. Perhaps you copy and paste it bad ways. Does it compile ok?
Reply
#3

Can you provide the Whole code of that CMD? as it doesn't look the whole
Reply
#4

Quote:
Originally Posted by alexus
Посмотреть сообщение
That's not the syntax of a command. Perhaps you copy and paste it bad ways. Does it compile ok?
its not copy paste

Код:
CMD:placemine(playerid,params[])
{
	new Float:MineX,Float:MineY,Float:MineZ;
	new Mine[128];
	if(MinePlaced[playerid] == 1)
	return SendClientMessage(playerid,COLOR_INDIANRED,"You have already place a mine somewhere.");
	if(GetPlayerState(playerid) == PLAYER_STATE_WASTED)
	return SendClientMessage(playerid,COLOR_INDIANRED,"You dead bruh.");
	if(sscanf(params,"s[128]",Mine))
	return SendClientMessage(playerid,COLOR_PAPAYAWHIP,"USAGE: /placemine [Mine]/[TMine]");
	else if(!strcmp(Mine, "Mine", true))
	{
		GetPlayerPos(playerid,MineX,MineY,MineZ);
		MineObject = CreateObject(1252,MineX,MineY,MineZ-1,0.0, 0.0, 96.0);
		for(new i = 0; i < MAX_PLAYERS; i++)
		MineLabel[i] = CreatePlayer3DTextLabel(i,"MINE HERE",COLOR_INDIANRED, MineX, MineY, MineZ,20.0);
		MinePos[playerid][0] = MineX;
		MinePos[playerid][1] = MineY;
		MinePos[playerid][2] = MineZ;
		SendClientMessage(playerid,COLOR_PURPLE,"You have placed a mine.");
		MineTimerUpdate[playerid] = SetTimerEx("MineTimer", 1000, true, "i", playerid);
		MinePlaced[playerid] = 1;
	}
    else if(!strcmp(Mine, "TMine", true))
	{
		new string[256],sec;
	    if(sscanf(params, "i", sec))
		return SendClientMessage(playerid, COLOR_RED, "USAGE: /placemine [Tmine] [Seconds]");
		TimeBombPlaced[playerid] = 1;
		GetPlayerPos(playerid,MineX,MineY,MineZ);
		TimeBombObject = CreateObject(1252,MineX,MineY,MineZ-1,0.0, 0.0, 96.0);
		MinePos[playerid][0] = MineX;
		MinePos[playerid][1] = MineY;
		MinePos[playerid][2] = MineZ;
		TimeBombLabel = Create3DTextLabel("MINE HERE",COLOR_INDIANRED, MineX, MineY, MineZ, 20.0, 0, 0);
		format(string,sizeof(string),"You have set a time bomb of %i seconds.",sec);
		SendClientMessage(playerid,COLOR_PURPLE,string);
		TimeBombUpdate[playerid] = SetTimerEx("TimeBomb", sec*1000, false, "i", playerid);
	}
	return 1;
}
Reply
#5

Can you wait till tomorrow I need to be.one my pc !!and can you show the codes of PLAYER_STATE_WASTED ?
And once check the codes at timebombobject !
Reply
#6

Could you explain the issue(s)?
Reply
#7

the problem is that the timebomb code is not working,mine code is working fine
Reply
#8

Quote:
Originally Posted by Nabster
Посмотреть сообщение
the problem is that the timebomb code is not working,mine code is working fine
But what exactly isn't working and could you post the "TimeBomb" function?
Reply
#9

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
But what exactly isn't working and could you post the "TimeBomb" function?
eh dude this part of code is not working

Код:
else if(!strcmp(Mine, "TMine", true))
	{
		new string[256],sec;
	    if(sscanf(params, "i", sec))
		return SendClientMessage(playerid, COLOR_RED, "USAGE: /placemine [Tmine] [Seconds]");
		TimeBombPlaced[playerid] = 1;
		GetPlayerPos(playerid,MineX,MineY,MineZ);
		TimeBombObject = CreateObject(1252,MineX,MineY,MineZ-1,0.0, 0.0, 96.0);
		MinePos[playerid][0] = MineX;
		MinePos[playerid][1] = MineY;
		MinePos[playerid][2] = MineZ;
		TimeBombLabel = Create3DTextLabel("MINE HERE",COLOR_INDIANRED, MineX, MineY, MineZ, 20.0, 0, 0);
		format(string,sizeof(string),"You have set a time bomb of %i seconds.",sec);
		SendClientMessage(playerid,COLOR_PURPLE,string);
		TimeBombUpdate[playerid] = SetTimerEx("TimeBomb", sec*1000, false, "i", playerid);
	}
Reply
#10

Not sure but I think the problem is here
Код:
if(sscanf(params, "i", sec))
sec will be set to the first param. You infact need to set it to the second parameter.
Try something like this
Код:
if(sscanf(params, "s[128]i", Mine, sec))
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)