error 029: invalid expression, assumed zero
#1

I dont know whats wrong and how to fix that problem
Error!
Код:
(15988) : error 029: invalid expression, assumed zero
Код:
CMD:dynamicgift(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "You must be on foot to use this command.");
return 1;
}

new string[128], Float:Position[4];
if(dynamicgift == 0)
{
(15988 ) LINE
Код:
if(dynamicgift == 0)
Thanks alot to one who fix that. will get rep+
Reply
#2

what are u trying to do with this ? if(dynamicgift == 0)
Reply
#3

Quote:
Originally Posted by cyberlord
Посмотреть сообщение
what are u trying to do with this ? if(dynamicgift == 0)
That is Line ( 15988 ) where is that Error.. I dont know. thats why I post few Lines on forst code
Reply
#4

paste more code please
Reply
#5

Код:
CMD:dynamicgift(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "You must be on foot to use this command.");
return 1;
}

new string[128], Float:Position[4];
if(dynamicgift == 0)
{
GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
GetPlayerFacingAngle(playerid, Position[3]);
dynamicgift = CreateDynamicObject(19054, Position[0], Position[1], Position[2]-0.4, 0.0, 0.0, Position[3], -1, -1, -1, 200.0);
dynamicgift3DText = CreateDynamic3DTextLabel("/getgift\nTogetagift.",COLOR_YELLOW,Position[0], Position[1], Position[2]+0.25,8.0);
SetPlayerPosEx(playerid, Position[0], Position[1], Position[2]+3);
format(string, sizeof(string), "AdmCmd: %s has placed the dynamic gift.", GetPlayerNameEx(playerid));
ABroadCast( COLOR_LIGHTRED, string, 1337);
}
else
{
DestroyDynamicObject(dynamicgift);
dynamicgift = 0;
DestroyDynamic3DTextLabel( Text3D:dynamicgift3DText );
format(string, sizeof(string), "AdmCmd: %s has destroyed the dynamic gift.", GetPlayerNameEx(playerid));
ABroadCast( COLOR_LIGHTRED, string, 1337);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You can not you this command.");
}
return 1;
}
Reply
#6

Hello there.
Код:
CMD:dynamicgift(playerid, params[])
if(dynamicgift == 0)
This makes compilator goes crazy.
You can not put name of command inside of if() statement.

Just try replacing
Код:
if(dynamicgift == 0)
with
Код:
if(true)
It will get compiled, but script beneath this condition will be run anyways.

Do you want to check for parameters provided using this command, or what?
Greetings.



Edition in progress
Reply
#7

Quote:
Originally Posted by LetsOWN[PL]
Посмотреть сообщение
Hello there.
Код:
CMD:dynamicgift(playerid, params[])
if(dynamicgift == 0)
This makes compilator goes crazy.
You can not put name of command inside of if() statement.

Just try replacing
Код:
if(dynamicgift == 0)
with
Код:
if(true)
It will get compiled, but script beneath this condition will be run anyways.

Do you want to check for parameters provided using this command, or what?
Greetings.



Edition in progress
I got 12 new errors :3
Reply
#8

okay i am not sure about this but i think on this code

Код:
if(dynamicgift == 0)
{
u want to check if gift are set , if no then u set if yes then u delete it but dynamicgift is the same variable that calls function cmd:dynamicgift so this makes my think that u are testing if player types dynamicgift or not , but in this case i think u need to use global variable like new bool:dynamicgift[MAX_PLAYERS]; and check him on your commands like if(dynamicgift[playerid] == false)
then do your code and chenge your variable value tu 1 ( dynamicgift[playerid] = true then when u calling else function you chould do like this else if(dynamicgift[playerid] == false)
do something and change value to true , hope u understand what i meen sorr for my bad english
hare is example for u

Код:
new bool:dynamicgift[MAX_PLAYERS] = false;

CMD:dynamicgift(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "You must be on foot to use this command.");
return 1;
}

new string[128], Float:Position[4];
if(dynamicgift[playerid] == false)
{
dynamicgift[playerid] = true;
}
else if (dynamicgift[playerid] == true)
{
dynamicgift[playerid] = false;
}
Reply
#9

Aww, no need to edit my last post to prevent nasty double posting, thanks c:

Try this:
Код:
// Top of the script
new DynamicGiftCreated = false;
new DynamicGiftOBJ; 
new Text3D:dynamicgift3DText;
/////
CMD:dynamicgift(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1337)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			SendClientMessageEx(playerid, COLOR_GREY, "You must be on foot to use this command.");
			return 1;
		}

		new string[128], Float:Position[4];
		if(!DynamicGiftCreated)
		{
			GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
			GetPlayerFacingAngle(playerid, Position[3]);
			DynamicGiftOBJ = CreateDynamicObject(19054, Position[0], Position[1], Position[2]-0.4, 0.0, 0.0, Position[3], -1, -1, -1, 200.0);
			dynamicgift3DText = CreateDynamic3DTextLabel("/getgift\nTogetagift.",COLOR_YELLOW,Position[0], Position[1], Position[2]+0.25,8.0);
			SetPlayerPosEx(playerid, Position[0], Position[1], Position[2]+3);
			format(string, sizeof(string), "AdmCmd: %s has placed the dynamic gift.", GetPlayerNameEx(playerid));
			ABroadCast( COLOR_LIGHTRED, string, 1337);
                        DynamicGiftCreated=true; // Ive forgot to add this..
		}
		else
		{
			DestroyDynamicObject(DynamicGiftOBJ);
			DynamicGiftCreated = false;
			DestroyDynamic3DTextLabel( dynamicgift3DText );
			format(string, sizeof(string), "AdmCmd: %s has destroyed the dynamic gift.", GetPlayerNameEx(playerid));
			ABroadCast( COLOR_LIGHTRED, string, 1337);
                       DynamicGiftCreated=false; // This either :<
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You can not you this command.");
	}
return 1;
}
I wrote it a little bit in hurry, but should work fine. Just let us know if everything's okay.
I've bolded the changes.

Greetings.
Reply
#10

Okay I made everything like you wrote.. I got now other error. maybe you or someone other can fix it easly

Lines!

Код:
CMD:getgift(playerid, params[])
{
new string[128];

if(IsPlayerInRangeOfPoint(playerid, 3.0,2546.680908, 1403.430786, 7699.584472))
{
if(PlayerInfo[playerid][pDonateRank] >= 1)
{
if(VIPGifts == 0 && PlayerInfo[playerid][pDonateRank] < 4)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Da Bi Khoa!");
return 1;
}
if(PlayerInfo[playerid][pGiftTime] > 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You already get a gift from last 5 hours!");
return 1;
}
format(string, sizeof(string), "* %s has close his eyes and wish a presents.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
GiftPlayer(MAX_PLAYERS, playerid);
}
}
(16031) : error 029: invalid expression, assumed zero
Код:
if(PlayerInfo[playerid][pDonateRank] >= 1)
(16033) : error 029: invalid expression, assumed zero
Код:
if(VIPGifts == 0 && PlayerInfo[playerid][pDonateRank] < 4)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)