Ich verzweifel mal wieder.
Vielen Dank im Vorraus und Frohes Neues!
Die Funktion:
IsValidPickupType(type[])
{
new functionName[MAX_FUNCTION_NAME];
Format:functionName("PUE_%s", type);// PUE = PickUpEvent
if (funcidx(functionName) == -1)
{
return false;
}
Format:functionName("PUMID_%s", type);// PUMID = PickUpModelID
if (funcidx(functionName) == -1)
{
return false;
}
return true;
}
Hier ist noch ein Teil wie die Funktion IsValidPickupType abgerufen wird
PCMD:addpickup[MAPPER](playerID, params[], StringID:96("Create a pickup"))
{
new type[256];
new Float:posX;
new Float:posY;
new Float:posZ;
if (sscanf(params, "s[256]", type))
{
CmdUsageMsg(playerID, "addpickup", "Type");
return COMMAND_USAGE;
}
type = strtoupper(type);
if (IsValidPickupType(type))
{
GetPlayerPos(playerID, posX, posY, posZ);
MySQLQuery("INSERT INTO `pickups` (`posX`, `posY`, `posZ`, `type`) VALUES('%f', '%f', '%f', '%s')", posX, posY, posZ, type);
new pickupID = mysql_insert_id();
if (pickupID)
{
if (AddPickup(pickupID, type, posX, posY, posZ))
{
SendClientMessageEx(playerID, COLOR_INFO, StringID:57("The pickup %s has been saved with ID %d"), type, pickupID);
return COMMAND_OK;
}
else
{
SendClientMessageEx(playerID, COLOR_ERROR, StringID:6("Error while creating the pickup!"));
}
}
else
{
SendClientMessageEx(playerID, COLOR_ERROR, StringID:6("Error while creating the pickup!"));
}
}
else
{
SendClientMessageEx(playerID, COLOR_ERROR, StringID:58("Invalid type!"));
}
return COMMAND_ERROR;
}