17.02.2015, 14:36
Look at your code properly..
So now lets try and fix it:
Oh... that was easy...
I could have found that answer if I searched properly.
References:
https://sampwiki.blast.hk/wiki/Control_Structures
pawn Code:
CMD:drop(playerid, params[])
{
//Drop[playerid] is not a valid object
//Drop2[playerid] is not a valid object
if(!IsValidDynamicObject(Drop[playerid]) && !IsValidDynamicObject(Drop2[playerid])) //This gets called, as both are not valid objects
{
SendClientMessage(playerid, WHITE, "1");
GetPlayerPos(playerid, dropcord[0], dropcord[1], dropcord[2]);
Drop[playerid] = CreateDynamicObject(2025, dropcord[0], dropcord[1], dropcord[2]-0.9, 0, 0, 0.00);
//Drop[playerid] is now a valid object
Droplabel[playerid] = CreateDynamic3DTextLabel("Drop 1", 0xFFFFFFAA,dropcord[0], dropcord[1], dropcord[2]-0.9, 2.5);
}
//Drop[playerid] is a valid object, because it was created above
//Drop2[playerid] is not a valid object
if(IsValidDynamicObject(Drop[playerid]) && !IsValidDynamicObject(Drop2[playerid])) //This is called, as Drop is valid, Drop2 is not
{ //// 2
SendClientMessage(playerid, WHITE, "2");
GetPlayerPos(playerid, dropcord[0], dropcord[1], dropcord[2]);
Drop2[playerid] = CreateDynamicObject(2025, dropcord[0], dropcord[1], dropcord[2]-0.9, 0, 0, 0.00);
//Drop2[playerid] is now a valid object
Droplabel2[playerid] = CreateDynamic3DTextLabel("Drop 2", 0xFFFFFFAA,dropcord[0], dropcord[1], dropcord[2]-0.9, 2.5);
}
//Drop[playerid] is a valid object
//Drop2[playerid] is a valid object
return 1;
}
pawn Code:
CMD:drop(playerid, params[])
{
if(!IsValidDynamicObject(Drop[playerid]) && !IsValidDynamicObject(Drop2[playerid]))
{
SendClientMessage(playerid, WHITE, "1");
GetPlayerPos(playerid, dropcord[0], dropcord[1], dropcord[2]);
Drop[playerid] = CreateDynamicObject(2025, dropcord[0], dropcord[1], dropcord[2]-0.9, 0, 0, 0.00);
Droplabel[playerid] = CreateDynamic3DTextLabel("Drop 1", 0xFFFFFFAA,dropcord[0], dropcord[1], dropcord[2]-0.9, 2.5);
}
else if(IsValidDynamicObject(Drop[playerid]) && !IsValidDynamicObject(Drop2[playerid]))
{
SendClientMessage(playerid, WHITE, "2");
GetPlayerPos(playerid, dropcord[0], dropcord[1], dropcord[2]);
Drop2[playerid] = CreateDynamicObject(2025, dropcord[0], dropcord[1], dropcord[2]-0.9, 0, 0, 0.00);
Droplabel2[playerid] = CreateDynamic3DTextLabel("Drop 2", 0xFFFFFFAA,dropcord[0], dropcord[1], dropcord[2]-0.9, 2.5);
}
return 1;
}
I could have found that answer if I searched properly.
References:
https://sampwiki.blast.hk/wiki/Control_Structures