stock CreateGroup(name[], tag[])
{
groupID++;
GroupInfo[groupID][groupTaken] = true;
format(GroupInfo[groupID][groupTag], 5, tag);
format(GroupInfo[groupID][groupName], 32, name);
return groupID, CallLocalFunction("OnCreateGroup", "dss", groupID, name, tag);
}
test = CreateGroup("Comb", "MICA");
test2 = CreateGroup("Slut", "CLUB");
printf("%d - test variable", test);
printf("%d - test2 variable", test2);
public OnCreateGroup(groupid, name[], tag[])
{
if(groupid == test)
{
print("test");
}
if(groupid == test2)
{
print("slut doval");
}
return 1;
}
return groupID, CallLocalFunction("OnCreateGroup", "dss", groupID, name, tag);
new test;
CreateGroup(test, "Comb", "MICA");
stock CreateGroup(&variable, name[], tag[])
{
groupID++;
variable = groupID;
GroupInfo[groupID][groupTaken] = true;
format(GroupInfo[groupID][groupTag], 5, tag);
format(GroupInfo[groupID][groupName], 32, name);
CallLocalFunction("OnCreateGroup", "dss", groupID, name, tag);
return 1;
}
|
PAWN is single-threaded, you're trying to use the variable before you assign a value to it.
I would use a timer, or: Код:
new test;
CreateGroup(test, "Comb", "MICA");
stock CreateGroup(&variable, name[], tag[])
{
groupID++;
variable = groupID;
GroupInfo[groupID][groupTaken] = true;
format(GroupInfo[groupID][groupTag], 5, tag);
format(GroupInfo[groupID][groupName], 32, name);
CallLocalFunction("OnCreateGroup", "dss", groupID, name, tag);
return 1;
}
|