Hallo,
ich bin etwas ratlos und google/SuFu spuckt auch nichts aus.
Ich möchte, dass, wenn der 2. Parameter bspw. "Name" ist, dass er dann einen 3. Parameter annimmt - passiert aber nicht, bekomme eine SSCANF-Warnung in der Konsole "String buffer overflow."
Command::editpickup(playerid, params[]) {
new pickupID,
enterExit[6],
additionalInt,
additionalText[50];
if(User::Get(playerid, "Admin") < 3)
return System::PermissionDenied(playerid);
if(sscanf(params, "ds[6]", pickupID, enterExit))
return System::IllegalParameters(playerid, "/editpickup [PickupID] [Enter/Exit/ToInt/ToBiz/ToVW/VW/Name]");
if(pickupID > DynamicPickups) {
SendFormatedMessage(playerid, COLOR_RED, "[ SYSTEM ] Falsche ID! Maximale ID: %d!", DynamicPickups);
return 1;
}
printf("pickupID: %d | maxPickups: %d | max_pickups: %d", pickupID, DynamicPickups, MAX_PICKUPS);
new Float:Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
if(!strcmp(enterExit, "Enter", true)) {
Pickup[pickupID][ppX] = Pos[0];
Pickup[pickupID][ppY] = Pos[1];
Pickup[pickupID][ppZ] = Pos[2];
DestroyPickup(Pickup[pickupID][ppPickup]);
Pickup[pickupID][ppPickup] = CreatePickup(1318, 23, Pickup[pickupID][ppX], Pickup[pickupID][ppY], Pickup[pickupID][ppZ], -1);
SendFormatedMessage(playerid, COLOR_GREEN, "[ EDIT PICKUP ] Eintrittsposition von PickupID '%s' (%d) geändert!", Pickup[pickupID][ppName], pickupID);
}
else if(!strcmp(enterExit, "Exit", true)) {
Pickup[pickupID][ppToX] = Pos[0];
Pickup[pickupID][ppToY] = Pos[1];
Pickup[pickupID][ppToZ] = Pos[2];
SendFormatedMessage(playerid, COLOR_GREEN, "[ EDIT PICKUP ] Ausgangsposition von PickupID '%s' (%d) geändert!", Pickup[pickupID][ppName], pickupID);
}
else if(!strcmp(enterExit, "ToInt", true)) {
if(sscanf(params, "ds[5]d", pickupID, enterExit, additionalInt))
return System::IllegalParameters(playerid, "/editpickup [PickupID] [ToInt] [InteriorID]");
Pickup[pickupID][ppToInt] = additionalInt;
SendFormatedMessage(playerid, COLOR_GREEN, "[ EDIT PICKUP ] Innenraum von PickupID '%s' (%d) geändert!", Pickup[pickupID][ppName], pickupID);
}
else if(!strcmp(enterExit, "ToBiz", true)) {
if(sscanf(params, "ds[5]d", pickupID, enterExit, additionalInt))
return System::IllegalParameters(playerid, "/editpickup [PickupID] [ToBiz] [BizID]");
Pickup[pickupID][ppToBizID] = additionalInt;
SendFormatedMessage(playerid, COLOR_GREEN, "[ EDIT PICKUP ] Geschäftszuordnung von PickupID '%s' (%d) geändert!", Pickup[pickupID][ppName], pickupID);
}
else if(!strcmp(enterExit, "ToVW", true)) {
if(sscanf(params, "ds[5]d", pickupID, enterExit, additionalInt))
return System::IllegalParameters(playerid, "/editpickup [PickupID] [ToVW] [VirtualWorld]");
Pickup[pickupID][ppToVW] = additionalInt;
SendFormatedMessage(playerid, COLOR_GREEN, "[ EDIT PICKUP ] Virtuelle Welt (Innen) von PickupID '%s' (%d) geändert!", Pickup[pickupID][ppName], pickupID);
}
else if(!strcmp(enterExit, "VW", true)) {
if(sscanf(params, "ds[5]d", pickupID, enterExit, additionalInt))
return System::IllegalParameters(playerid, "/editpickup [PickupID] [VW] [VirtualWorld]");
Pickup[pickupID][ppVW] = additionalInt;
SendFormatedMessage(playerid, COLOR_GREEN, "[ EDIT PICKUP ] Virtuelle Welt von PickupID '%s' (%d) geändert!", Pickup[pickupID][ppName], pickupID);
}
else if(!strcmp(enterExit, "Name", true)) {
if(sscanf(params, "ds[5]s[50]", pickupID, enterExit, additionalText))
return System::IllegalParameters(playerid, "/editpickup [PickupID] [Name] [Neuer Name]");
format(Pickup[pickupID][ppName], 50, "%s", additionalText);
SendFormatedMessage(playerid, COLOR_GREEN, "[ EDIT PICKUP ] Name von PickupID '%s' (%d) geändert!", Pickup[pickupID][ppName], pickupID);
}
else {
return System::IllegalParameters(playerid, "/editpickuppos [PickupID] [Enter/Exit]");
}
return 1;
}